Author: ehillenius
Date: Fri Jun  8 12:01:23 2007
New Revision: 545595

URL: http://svn.apache.org/viewvc?view=rev&rev=545595
Log:
catch parse error explicitly

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=545595&r1=545594&r2=545595
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
 Fri Jun  8 12:01:23 2007
@@ -496,6 +496,23 @@
                                        + " = " + interfaceParameter);
                }
 
+               // Extract version
+               String versionNumberString = null;
+               try
+               {
+                       versionNumberString = 
pathComponents[pathComponents.length - 4];
+                       final int versionNumber = 
Strings.isEmpty(versionNumberString) ? 0 : Integer
+                                       .parseInt(versionNumberString);
+                       parameters.setVersionNumber(versionNumber);
+               }
+               catch (NumberFormatException e)
+               {
+                       throw new WicketRuntimeException("Internal error 
parsing " + INTERFACE_PARAMETER_NAME
+                                       + " = " + interfaceParameter
+                                       + "; wrong format for page version 
argument. Expected a number but was '"
+                                       + versionNumberString + "'", e);
+               }
+
                // Set pagemap name
                final String pageMapName = pathComponents[0];
                parameters.setPageMapName(pageMapName.length() == 0 ? 
PageMap.DEFAULT_NAME : pageMapName);
@@ -516,12 +533,6 @@
                                ? interfaceName
                                : IRedirectListener.INTERFACE.getName());
 
-               // Extract version
-               final String versionNumberString = 
pathComponents[pathComponents.length - 4];
-               final int versionNumber = Strings.isEmpty(versionNumberString) 
? 0 : Integer
-                               .parseInt(versionNumberString);
-               parameters.setVersionNumber(versionNumber);
-
                // Component path is everything after pageMapName and before 
version
                final int start = pageMapName.length() + 1;
                final int end = interfaceParameter.length() - 
behaviourId.length() - interfaceName.length()
@@ -1034,6 +1045,5 @@
                                }
                        }
                };
-
        }
 }


Reply via email to