Author: niallp
Date: Tue Apr 26 12:08:32 2005
New Revision: 164862

URL: http://svn.apache.org/viewcvs?rev=164862&view=rev
Log:
Port fix for PR #19901 to 1.2.x branch - Adding check for null page value and 
throwing more informative exception

Modified:
    
struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/validator/DynaValidatorForm.java

Modified: 
struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/validator/DynaValidatorForm.java
URL: 
http://svn.apache.org/viewcvs/struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/validator/DynaValidatorForm.java?rev=164862&r1=164861&r2=164862&view=diff
==============================================================================
--- 
struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/validator/DynaValidatorForm.java
 (original)
+++ 
struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/validator/DynaValidatorForm.java
 Tue Apr 26 12:08:32 2005
@@ -1,7 +1,7 @@
 /*
  * $Id$ 
  *
- * Copyright 2000-2004 The Apache Software Foundation.
+ * Copyright 2000-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -136,13 +136,18 @@
     protected void setPageFromDynaProperty() {
         Map props = this.getMap();
         if (props.containsKey("page")) {
+            Integer p = null;
             try {
-                this.page = ((Integer) props.get("page")).intValue();
-
+                p = (Integer)props.get("page");
             } catch (ClassCastException e) {
                 log.error("Dyna 'page' property must be of type 
java.lang.Integer.", e);
                 throw e;
             }
+            if (p == null) {
+                throw new NullPointerException("Dyna 'page' property must not 
be null. " +
+                    " Either provide an initial value or set 'convertNull' to 
false. ");
+            }              
+            this.page = p.intValue();
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to