Commits

rainerh  committed 8978804

XW-645 Logging is to verbose in ParamtersInterceptor

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

  • Participants
  • Parent commits f721a23

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java

                     if (action instanceof ValidationAware) {
                         ((ValidationAware) action).addActionMessage(developerNotification);
                     }
-                } else {
-                    LOG.error("ParametersInterceptor - [setParameters]: Unexpected Exception caught setting '" + name + "' on '" + action.getClass() + ": " + e.getMessage());
+                    LOG.warn("ParametersInterceptor - [setParameters]: Unexpected Exception caught setting '" + name + "' on '" + action.getClass() + ": " + e.getMessage());
                 }
             }
         }

File src/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java

 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ValidationAware;
+import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.Parameterizable;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 
     private boolean parse;
     private boolean overwrite;
 
+    static boolean devMode = false;
+
     private static final Logger LOG = LoggerFactory.getLogger(StaticParametersInterceptor.class);
 
+    @Inject("devMode")
+    public static void setDevMode(String mode) {
+        devMode = "true".equals(mode);
+    }    
+
     public void setParse(String value) {
         this.parse = Boolean.valueOf(value).booleanValue();
     }
                 if (parse && val instanceof String) {
                     val = TextParseUtil.translateVariables(val.toString(), stack);
                 }
-                stack.setValue(entry.getKey(), val);
+                try {
+                    stack.setValue(entry.getKey(), val);
+                } catch (RuntimeException e) {
+                    if (devMode) {
+                        String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{
+                                e.getMessage()
+                        });
+                        LOG.error(developerNotification);
+                        if (action instanceof ValidationAware) {
+                            ((ValidationAware) action).addActionMessage(developerNotification);
+                        }
+                        LOG.warn("StaticParametersInterceptor - [setParameters]: Unexpected Exception caught setting '" + entry.getKey() + "' on '" + action.getClass() + ": " + e.getMessage());
+                    }
+                }
             }
             addParametersToContext(ac, parameters);
         }