Author: sichen
Date: Fri Jul 13 18:16:16 2007
New Revision: 556198
URL:
http://svn.apache.org/viewvc?view=rev&rev=556198Log:
Null check for spider session removal code, to prevent crashes in cases you didn't set it up in url.properties
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java?view=diff&rev=556198&r1=556197&r2=556198==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java Fri Jul 13 18:16:16 2007
@@ -1085,15 +1085,17 @@
}else{
String initialUserAgent = request.getHeader("User-Agent") != null ? request.getHeader("User-Agent") : "";
List spiderList = StringUtil.split(UtilProperties.getPropertyValue("url", "link.remove_lsessionid.user_agent_list"), ",");
- Iterator spiderListIter = spiderList.iterator();
- while (spiderListIter.hasNext()) {
- String spiderNameElement = (String) spiderListIter.next();
- Pattern p = Pattern.compile("^.*" + spiderNameElement + ".*$", Pattern.CASE_INSENSITIVE);
- Matcher m = p.matcher(initialUserAgent);
- if (m.find()){
- request.setAttribute("_REQUEST_FROM_SPIDER_", "Y");
- result = true;
- break;
+ if (UtilValidate.isNotEmpty(spiderList)) {
+ Iterator spiderListIter = spiderList.iterator();
+ while (spiderListIter.hasNext()) {
+ String spiderNameElement = (String) spiderListIter.next();
+ Pattern p = Pattern.compile("^.*" + spiderNameElement + ".*$", Pattern.CASE_INSENSITIVE);
+ Matcher m = p.matcher(initialUserAgent);
+ if (m.find()){
+ request.setAttribute("_REQUEST_FROM_SPIDER_", "Y");
+ result = true;
+ break;
+ }
}
}
}