struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hrab...@apache.org
Subject svn commit: r168011 - /struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java
Date Tue, 03 May 2005 22:36:55 GMT
Author: hrabago
Date: Tue May  3 15:36:53 2005
New Revision: 168011

URL: http://svn.apache.org/viewcvs?rev=168011&view=rev
Log:
Prevent NullPointerException when toString() is called before dynaClass is initialized.

Modified:
    struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java

Modified: struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java?rev=168011&r1=168010&r2=168011&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/action/DynaActionForm.java Tue May  3 15:36:53
2005
@@ -507,8 +507,13 @@
     public String toString() {
 
         StringBuffer sb = new StringBuffer("DynaActionForm[dynaClass=");
-        sb.append(getDynaClass().getName());
-        DynaProperty props[] = getDynaClass().getDynaProperties();
+        DynaClass dynaClass = getDynaClass();
+        if (dynaClass == null) {
+            return sb.append("null]").toString();
+        }
+        
+        sb.append(dynaClass.getName());
+        DynaProperty props[] = dynaClass.getDynaProperties();
         if (props == null) {
             props = new DynaProperty[0];
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message