Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.marketing.tracking. (OFBIZ-9823) The patch was modified because the repeated conditional check in TrackingCodeEvents was simplified too much. Thanks Dennis Balkir for reporting and providing the patch. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1817692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+10
-2
@@ -268,9 +268,17 @@ public class TrackingCodeEvents {
|
||||
}
|
||||
}
|
||||
|
||||
if (visitorSiteId == null || (visitorSiteId != null && !visitorSiteId.equals(siteId) && siteId != null)) {
|
||||
if (visitorSiteId == null || (siteId != null && !visitorSiteId.equals(siteId))) {
|
||||
// if trackingCode.siteId is not null write a trackable cookie with name in the form: Ofbiz.TKCSiteId and timeout will be 60 * 60 * 24 * 365
|
||||
Cookie siteIdCookie = new Cookie("Ofbiz.TKCD.SiteId", siteId);
|
||||
String siteIdEnc;
|
||||
try {
|
||||
siteIdEnc = URLEncoder.encode(siteId, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
Debug.logWarning("There went something wrong while encoding for the cookie creation in TrackingCodeEvents.processTrackingCode", module);
|
||||
return "error";
|
||||
}
|
||||
Cookie siteIdCookie = new Cookie("Ofbiz.TKCD.SiteId", siteIdEnc);
|
||||
siteIdCookie.setMaxAge(siteIdCookieAge);
|
||||
siteIdCookie.setPath("/");
|
||||
if (cookieDomain.length() > 0) siteIdCookie.setDomain(cookieDomain);
|
||||
|
||||
Reference in New Issue
Block a user