You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/08/26 10:05:23 UTC

svn commit: r1620526 - in /ofbiz/branches/framework-api-cleanup: ./ applications/marketing/src/org/ofbiz/marketing/tracking/ applications/order/src/org/ofbiz/order/shoppingcart/ framework/webapp/src/org/ofbiz/webapp/stats/

Author: jacopoc
Date: Tue Aug 26 08:05:23 2014
New Revision: 1620526

URL: http://svn.apache.org/r1620526
Log:
Merged latest trunk changes.

Modified:
    ofbiz/branches/framework-api-cleanup/   (props changed)
    ofbiz/branches/framework-api-cleanup/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
    ofbiz/branches/framework-api-cleanup/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
    ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java

Propchange: ofbiz/branches/framework-api-cleanup/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1620258-1620525

Modified: ofbiz/branches/framework-api-cleanup/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java?rev=1620526&r1=1620525&r2=1620526&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java (original)
+++ ofbiz/branches/framework-api-cleanup/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java Tue Aug 26 08:05:23 2014
@@ -188,9 +188,7 @@ public class TrackingCodeEvents {
 
         //persist that info by associating with the current visit
         GenericValue visit = VisitHandler.getVisit(request.getSession());
-        if (visit == null && !UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist.visit", "false")) {
-            Debug.logWarning("Could not get visit, not associating trackingCode [" + trackingCodeId + "] with visit", module);
-        } else {
+        if (visit != null) {
             GenericValue trackingCodeVisit = delegator.makeValue("TrackingCodeVisit",
                     UtilMisc.toMap("trackingCodeId", trackingCodeId, "visitId", visit.get("visitId"),
                     "fromDate", UtilDateTime.nowTimestamp(), "sourceEnumId", sourceEnumId));
@@ -312,9 +310,7 @@ public class TrackingCodeEvents {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         java.sql.Timestamp nowStamp = UtilDateTime.nowTimestamp();
         GenericValue visit = VisitHandler.getVisit(request.getSession());
-        if (visit == null && !UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist.visit", "false")) {
-            Debug.logWarning("Could not get visit, not checking trackingCode cookies to associate with visit", module);
-        } else {
+        if (visit != null) {
             // loop through cookies and look for ones with a name that starts with TKCDT_ for trackable cookies
             Cookie[] cookies = request.getCookies();
 

Modified: ofbiz/branches/framework-api-cleanup/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=1620526&r1=1620525&r2=1620526&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java (original)
+++ ofbiz/branches/framework-api-cleanup/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java Tue Aug 26 08:05:23 2014
@@ -70,8 +70,7 @@ public class CartEventListener implement
 
             GenericValue visit = VisitHandler.getVisit(session);
             if (visit == null) {
-            if (UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist.visit", "false")) return;
-                Debug.logError("Could not get the current visit, not saving abandoned cart info.", module);
+                Debug.logInfo("Could not get the current visit, not saving abandoned cart info.", module);
                 return;
             }
 

Modified: ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=1620526&r1=1620525&r2=1620526&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Tue Aug 26 08:05:23 2014
@@ -45,6 +45,17 @@ public class VisitHandler {
 
     public static final String visitorCookieName = "OFBiz.Visitor";
 
+    private static final InetAddress address;
+    static {
+        InetAddress tmpAddress = null;
+        try {
+            tmpAddress = InetAddress.getLocalHost();
+        } catch (java.net.UnknownHostException e) {
+            Debug.logError("Unable to get server's internet address: " + e.toString(), module);
+        }
+        address = tmpAddress;
+    }
+
     public static void setUserLogin(HttpSession session, GenericValue userLogin, boolean userCreated) {
         if (userLogin == null) return;
         ModelEntity modelUserLogin = userLogin.getModelEntity();
@@ -165,17 +176,11 @@ public class VisitHandler {
                             }
 
                             // get localhost ip address and hostname to store
-                            try {
-                                InetAddress address = InetAddress.getLocalHost();
-                                if (address != null) {
-                                    visit.set("serverIpAddress", address.getHostAddress());
-                                    visit.set("serverHostName", address.getHostName());
-                                } else {
-                                    Debug.logError("Unable to get localhost internet address, was null", module);
-                                }
-                            } catch (java.net.UnknownHostException e) {
-                                Debug.logError("Unable to get localhost internet address: " + e.toString(), module);
+                            if (address != null) {
+                                visit.set("serverIpAddress", address.getHostAddress());
+                                visit.set("serverHostName", address.getHostName());
                             }
+
                             try {
                                 visit = delegator.createSetNextSeqId(visit);
                                 session.setAttribute("visit", visit);