Author: adityasharma
Date: Fri Aug 17 12:46:59 2018 New Revision: 1838256 URL: http://svn.apache.org/viewvc?rev=1838256&view=rev Log: Improved: Remove checks to store only 250 characters of URL in VisitHandler.getVisit() & ServerHitBin.saveHit() (OFBIZ-10508) When the code was committed the 'URL' field type had a size of 255 characters only which was later changed to 2000 characters. So, the above code logic to restrict no of characters can be removed now. Removed null pointer check for initialRequest and initialReferrer as it is already handled while setting the values in UtilHttp.setInitialRequestInfo() method. Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java?rev=1838256&r1=1838255&r2=1838256&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java Fri Aug 17 12:46:59 2018 @@ -516,10 +516,10 @@ public class ServerHitBin { String fullRequestUrl = UtilHttp.getFullRequestUrl(request); - serverHit.set("requestUrl", fullRequestUrl.length() > 250 ? fullRequestUrl.substring(0, 250) : fullRequestUrl); + serverHit.set("requestUrl", fullRequestUrl); String referrerUrl = request.getHeader("Referer") != null ? request.getHeader("Referer") : ""; - serverHit.set("referrerUrl", referrerUrl.length() > 250 ? referrerUrl.substring(0, 250) : referrerUrl); + serverHit.set("referrerUrl", referrerUrl); // get localhost ip address and hostname to store if (VisitHandler.address != null) { Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java?rev=1838256&r1=1838255&r2=1838256&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/VisitHandler.java Fri Aug 17 12:46:59 2018 @@ -147,8 +147,8 @@ public class VisitHandler { visit.set("fromDate", new Timestamp(session.getCreationTime())); visit.set("initialLocale", initialLocale); - if (initialRequest != null) visit.set("initialRequest", initialRequest.length() > 250 ? initialRequest.substring(0, 250) : initialRequest); - if (initialReferrer != null) visit.set("initialReferrer", initialReferrer.length() > 250 ? initialReferrer.substring(0, 250) : initialReferrer); + visit.set("initialRequest", initialRequest); + visit.set("initialReferrer", initialReferrer); if (initialUserAgent != null) visit.set("initialUserAgent", initialUserAgent.length() > 250 ? initialUserAgent.substring(0, 250) : initialUserAgent); visit.set("webappName", webappName); if (UtilProperties.propertyValueEquals("serverstats", "stats.proxy.enabled", "true")) { |
Free forum by Nabble | Edit this page |