commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1382115 - in /commons/proper/digester/trunk: core/src/main/java/org/apache/commons/digester3/Digester.java src/changes/changes.xml
Date Fri, 07 Sep 2012 18:32:04 GMT
Author: simonetripodi
Date: Fri Sep  7 18:32:03 2012
New Revision: 1382115

URL: http://svn.apache.org/viewvc?rev=1382115&view=rev
Log:
[DIGESTER-170] Digester.pop(String) throws EmptyStackException where API doc says it returns
null

Modified:
    commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/Digester.java
    commons/proper/digester/trunk/src/changes/changes.xml

Modified: commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/Digester.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/Digester.java?rev=1382115&r1=1382114&r2=1382115&view=diff
==============================================================================
--- commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/Digester.java
(original)
+++ commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/Digester.java
Fri Sep  7 18:32:03 2012
@@ -2747,7 +2747,6 @@ public class Digester
      */
     public <T> T pop( String stackName )
     {
-        T result = null;
         Stack<Object> namedStack = stacksByName.get( stackName );
         if ( namedStack == null )
         {
@@ -2755,17 +2754,23 @@ public class Digester
             {
                 log.debug( "Stack '" + stackName + "' is empty" );
             }
-            throw new EmptyStackException();
+            return null;
         }
 
-        result = this.<T> npeSafeCast( namedStack.pop() );
-
-        if ( stackAction != null )
+        try
+        {
+            T popped = this.<T> npeSafeCast( namedStack.pop() );
+            if ( stackAction != null )
+            {
+                popped = stackAction.onPop( this, stackName, popped );
+            }
+            return popped;
+        }
+        catch ( EmptyStackException e )
         {
-            result = stackAction.onPop( this, stackName, result );
+            log.warn( "Empty stack (returning null)" );
+            return ( null );
         }
-
-        return result;
     }
 
     /**

Modified: commons/proper/digester/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/changes/changes.xml?rev=1382115&r1=1382114&r2=1382115&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/changes/changes.xml (original)
+++ commons/proper/digester/trunk/src/changes/changes.xml Fri Sep  7 18:32:03 2012
@@ -23,6 +23,9 @@
   </properties>
   <body>
   <release version="3.3" date="201?-??-??" description="Maintenance release.">
+    <action dev="simonetripodi" type="fix" issue="DIGESTER-170" due-to="Dale Wijnand">
+      Digester.pop(String) throws EmptyStackException where API doc says it returns null
+    </action>
     <action dev="simonetripodi" type="fix" issue="DIGESTER-169" due-to="Eugene Fedotov">
       Problem when including rules XML file with "classpath:" URL prefix
     </action>



Mime
View raw message