svn commit: r830366 - /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: r830366 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java

jleroux@apache.org
Author: jleroux
Date: Tue Oct 27 22:13:53 2009
New Revision: 830366

URL: http://svn.apache.org/viewvc?rev=830366&view=rev
Log:
A patch from Patrick Antivackis "NPE when calling a page like http://localhost:8080/cmssite/cms" (https://issues.apache.org/jira/browse/OFBIZ-3096) - OFBIZ-3096
A Null Pointer Exception is generated by RequestHandler.trackVIsit and trackStat if a page is called without view and without trailing slash after the controller.
This may be not a problem for non cms site, but it is for cms site. Calling http://localhost:8080/cmssite/cms will generate a NPE; WIth the included pacth, calling the same page will display the default page.

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=830366&r1=830365&r2=830366&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 Tue Oct 27 22:13:53 2009
@@ -580,7 +580,7 @@
                 }
                 renderView(viewName, requestMap.securityExternalView, request, response, null);
             } else if ("view-last-noparam".equals(nextRequestResponse.type)) {
-             if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is a view." + " sessionId=" + UtilHttp.getSessionId(request), module);
+                 if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is a view." + " sessionId=" + UtilHttp.getSessionId(request), module);
 
                  // check for an override view, only used if "success" = eventReturn
                  String viewName = (UtilValidate.isNotEmpty(overrideViewUri) && (eventReturn == null || "success".equals(eventReturn))) ? overrideViewUri : nextRequestResponse.value;
@@ -596,7 +596,7 @@
                      viewName = nextRequestResponse.value;
                  }
                  renderView(viewName, requestMap.securityExternalView, request, response, null);
- } else if ("view-home".equals(nextRequestResponse.type)) {
+            } else if ("view-home".equals(nextRequestResponse.type)) {
                 if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is a view." + " sessionId=" + UtilHttp.getSessionId(request), module);
 
                 // check for an override view, only used if "success" = eventReturn
@@ -1112,6 +1112,9 @@
     public boolean trackStats(HttpServletRequest request) {
         if (!"false".equalsIgnoreCase(context.getInitParameter("track-serverhit"))) {
             String uriString = RequestHandler.getRequestUri(request.getPathInfo());
+            if (uriString == null) {
+                uriString="";
+            }
             ConfigXMLReader.RequestMap requestMap = getControllerConfig().requestMapMap.get(uriString);
             if (requestMap == null) return false;
             return requestMap.trackServerHit;
@@ -1123,6 +1126,9 @@
     public boolean trackVisit(HttpServletRequest request) {
         if (!"false".equalsIgnoreCase(context.getInitParameter("track-visit"))) {
             String uriString = RequestHandler.getRequestUri(request.getPathInfo());
+            if (uriString == null) {
+                uriString="";
+            }
             ConfigXMLReader.RequestMap requestMap = getControllerConfig().requestMapMap.get(uriString);
             if (requestMap == null) return false;
             return requestMap.trackVisit;