struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hrab...@apache.org
Subject svn commit: r168012 - /struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/action/DynaActionForm.java
Date Tue, 03 May 2005 22:39:12 GMT
Author: hrabago
Date: Tue May  3 15:39:10 2005
New Revision: 168012

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

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

Modified: struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/action/DynaActionForm.java
URL: http://svn.apache.org/viewcvs/struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/action/DynaActionForm.java?rev=168012&r1=168011&r2=168012&view=diff
==============================================================================
--- struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/action/DynaActionForm.java
(original)
+++ struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/action/DynaActionForm.java
Tue May  3 15:39:10 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