svn commit: r757334 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r757334 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

hansbak-2
Author: hansbak
Date: Mon Mar 23 07:32:21 2009
New Revision: 757334

URL: http://svn.apache.org/viewvc?rev=757334&view=rev
Log:
better error messages in request handler instead of null pointer exceptions

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=757334&r1=757333&r2=757334&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Mon Mar 23 07:32:21 2009
@@ -133,7 +133,9 @@
         }
         // check for default request
         if (requestMap == null) {
-            requestMap = controllerConfig.requestMapMap.get(controllerConfig.defaultRequest);
+         if (controllerConfig.defaultRequest != null) { // required! to avoid a null pointer exception and generate a requesthandler exception if default request not found.
+         requestMap = controllerConfig.requestMapMap.get(controllerConfig.defaultRequest);
+         }
         }
         // still not found so stop
         if (requestMap == null) {
@@ -147,6 +149,9 @@
         if (chain != null) {
             String chainRequestUri = RequestHandler.getRequestUri(chain);
             requestMap = controllerConfig.requestMapMap.get(chainRequestUri);
+            if (requestMap == null) {
+                throw new RequestHandlerException("Unknown chained request [" + chainRequestUri + "]; this request does not exist");
+            }
             if (request.getAttribute("_POST_CHAIN_VIEW_") != null) {
                 overrideViewUri = (String) request.getAttribute("_POST_CHAIN_VIEW_");
             } else {
@@ -160,7 +165,7 @@
             }
 
             // Check to make sure we are allowed to access this request directly. (Also checks if this request is defined.)
-            // If the request cannot be called, or is not defined, check and see if there is a default-request we an process
+            // If the request cannot be called, or is not defined, check and see if there is a default-request we can process
             if (!requestMap.securityDirectRequest && controllerConfig.defaultRequest != null) {
                 if (!controllerConfig.requestMapMap.get(controllerConfig.defaultRequest).securityDirectRequest) {
                     // use the same message as if it was missing for security reasons, ie so can't tell if it is missing or direct request is not allowed