Commits

Anonymous committed 3f98c70

Issue number: XW-378
Obtained from:
Submitted by:
Reviewed by:
Enable devMode dependent lookup failure logging for all find methods

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk/src@968e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 028bce2

Comments (0)

Files changed (1)

File java/com/opensymphony/xwork/util/OgnlValueStack.java

         } catch (OgnlException e) {
             return findInContext(expr);
         } catch (Exception e) {
-            StringBuffer msg = new StringBuffer();
-            msg.append("Caught an exception while evaluating expression '").append(expr).append("' against value stack");
-            if (isDevModeEnabled() && LOG.isWarnEnabled()) {
-                LOG.warn( msg , e);
-                LOG.warn("NOTE: Previous warning message was issued due to devMode set to true.");
-            } else if ( LOG.isDebugEnabled() ) {
-                LOG.debug( msg , e);
-            }
+            logLookupFailure(expr, e);
 
             return findInContext(expr);
         } finally {
         } catch (OgnlException e) {
             return findInContext(expr);
         } catch (Exception e) {
-            LOG.warn("Caught an exception while evaluating expression '" + expr + "' against value stack", e);
+            logLookupFailure(expr, e);
 
             return findInContext(expr);
         } finally {
     }
 
     /**
+     * Log a failed lookup, being more verbose when devMode=true.
+     *
+     * @param expr The failed expression
+     * @param e The thrown exception.
+     */
+    private void logLookupFailure(String expr, Exception e) {
+        StringBuffer msg = new StringBuffer();
+        msg.append("Caught an exception while evaluating expression '").append(expr).append("' against value stack");
+        if (isDevModeEnabled() && LOG.isWarnEnabled()) {
+            LOG.warn( msg , e);
+            LOG.warn("NOTE: Previous warning message was issued due to devMode set to true.");
+        } else if ( LOG.isDebugEnabled() ) {
+            LOG.debug( msg , e);
+        }
+    }
+
+    /**
      * Get the object on the top of the stack without changing the stack.
      *
      * @see CompoundRoot#peek()