[DIGESTER-170] Digester.pop(String) throws EmptyStackException where API doc says it returns null

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/digester/trunk@1382115 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/commons/digester3/Digester.java b/core/src/main/java/org/apache/commons/digester3/Digester.java
index 3858884..367c33e 100644
--- a/core/src/main/java/org/apache/commons/digester3/Digester.java
+++ b/core/src/main/java/org/apache/commons/digester3/Digester.java
@@ -2747,7 +2747,6 @@
      */
     public <T> T pop( String stackName )
     {
-        T result = null;
         Stack<Object> namedStack = stacksByName.get( stackName );
         if ( namedStack == null )
         {
@@ -2755,17 +2754,23 @@
             {
                 log.debug( "Stack '" + stackName + "' is empty" );
             }
-            throw new EmptyStackException();
+            return null;
         }
 
-        result = this.<T> npeSafeCast( namedStack.pop() );
-
-        if ( stackAction != null )
+        try
         {
-            result = stackAction.onPop( this, stackName, result );
+            T popped = this.<T> npeSafeCast( namedStack.pop() );
+            if ( stackAction != null )
+            {
+                popped = stackAction.onPop( this, stackName, popped );
+            }
+            return popped;
         }
-
-        return result;
+        catch ( EmptyStackException e )
+        {
+            log.warn( "Empty stack (returning null)" );
+            return ( null );
+        }
     }
 
     /**
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b30ad4f..a17909a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -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>