You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/02/13 05:50:25 UTC

svn commit: r153603 - jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java

Author: skitching
Date: Sat Feb 12 20:50:24 2005
New Revision: 153603

URL: http://svn.apache.org/viewcvs?view=rev&rev=153603
Log:
Clean up nasty stack hack.

Modified:
    jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java

Modified: jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java?view=diff&r1=153602&r2=153603
==============================================================================
--- jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java (original)
+++ jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/actions/SetPropertyAction.java Sat Feb 12 20:50:24 2005
@@ -233,16 +233,7 @@
         if (xmlAttributeName != null) {
             // the target property to set will have been decided in the
             // begin method...
-            //
-            // Note that there is a theoretical problem here; we are pushing
-            // onto the stack in begin, and popping in body not in end. This
-            // means that the stack order can get stuffed up. However we are
-            // using a per-instance stack, so the problem only occurs if
-            // the same rule *instance* matches *the same xml element* multiple
-            // times, and there's no reason to ever do that. And anyway in that
-            // case the targetProperty value will be the same for each entry
-            // on the stack, so it doesn't matter if they get swapped!
-            targetProperty = (String) context.pop(PROPERTY_NAME_STACK);
+            targetProperty = (String) context.peek(PROPERTY_NAME_STACK);
         } else if (targetProperty == null) {
             // If we don't have a specific property name, use the element name.
             //
@@ -300,6 +291,19 @@
                 + top.getClass().getName() + "'", ex);
         }
     }
+
+    /**
+     * Process the end of this element.
+     */
+    public void end(Context context, String namespace, String name)
+    throws ParseException {
+        Log log = context.getLogger();
+        if (xmlAttributeName != null) {
+            // discard the target property extracted from the xml attribute.
+            context.pop(PROPERTY_NAME_STACK);
+        }
+    }
+
 
     /**
      * Render a printable version of this Actuib.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org