Commits

jholmes  committed 7079028

XW-542 update error message in OgnlValueStack.setValue() to report all values in an array

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

  • Participants
  • Parent commits 61b85ce

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork2/util/OgnlValueStack.java

             }
         } catch (RuntimeException re) { //XW-281
             if (throwExceptionOnFailure) {
-                String msg = "Error setting expression '" + expr + "' with value '" + value + "'";
-                throw new XWorkException(msg, re);
+                StringBuffer msg = new StringBuffer();
+                msg.append("Error setting expression '");
+                msg.append(expr);
+                msg.append("' with value ");
+
+                if (value instanceof Object[]) {
+                    Object[] valueArray = (Object[]) value;
+                    msg.append("[");
+                    for (int index = 0; index < valueArray.length; index++) {
+                        msg.append("'");
+                        msg.append(valueArray[index]);
+                        msg.append("'");
+
+                        if (index < (valueArray.length + 1))
+                            msg.append(", ");
+                    }
+                    msg.append("]");
+                } else {
+                    msg.append("'");
+                    msg.append(value);
+                    msg.append("'");
+                }
+
+                throw new XWorkException(msg.toString(), re);
             } else {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Error setting value", re);