Author: jleroux
Date: Mon Oct 11 13:43:38 2010
New Revision: 1021344
URL:
http://svn.apache.org/viewvc?rev=1021344&view=revLog:
A patch from Sascah Rodekamp "Server Hit Bin, counterHit receive delegator" (
https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/OFBIZ-3984) - OFBIZ-3984
Patch to improve the delegator call in the countHit method.
The method got the delegator name from the session and got, with this delegator name over the delegator factory, the delegator.
But when the delegator name was not available in the session the method crashes.
I try to get the delegator from the request, and if their is no delegator object I go the factory way.
I think it's a little bit saver to get a delegator object this way
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1021344&r1=1021343&r2=1021344&view=diff==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Mon Oct 11 13:43:38 2010
@@ -111,9 +111,9 @@ public class ServerHitBin {
}
protected static void countHit(String baseId, int type, HttpServletRequest request, long startTime, long runningTime, GenericValue userLogin, boolean isOriginal) {
- String delegatorName = (String) request.getSession().getAttribute("delegatorName");
- Delegator delegator = null;
- if (UtilValidate.isNotEmpty(delegatorName)) {
+ Delegator delegator = (Delegator)request.getAttribute("delegator");
+ if (delegator == null){
+ String delegatorName = (String)request.getSession().getAttribute("delegatorName");
delegator = DelegatorFactory.getDelegator(delegatorName);
}
if (delegator == null) {