devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wk...@apache.org
Subject svn commit: r1649257 - /devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
Date Sat, 03 Jan 2015 22:39:58 GMT
Author: wkeil
Date: Sat Jan  3 22:39:57 2015
New Revision: 1649257

URL: http://svn.apache.org/r1649257
Log:
DMAP-117: Results differ from OS version in UA 

Task-Url: https://issues.apache.org/jira/browse/DMAP-117

Modified:
    devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java

Modified: devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java?rev=1649257&r1=1649256&r2=1649257&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
(original)
+++ devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/device/AndroidDeviceBuilder.java
Sat Jan  3 22:39:57 2015
@@ -19,8 +19,6 @@
 package org.apache.devicemap.simpleddr.builder.device;
 
 import static org.apache.devicemap.simpleddr.model.os.OperatingSystem.ANDROID;
-import static org.apache.devicemap.simpleddr.ODDRService.ODDR_DEFAULT_THRESHOLD;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -39,7 +37,7 @@ public class AndroidDeviceBuilder extend
     private static final String BUILD_HASH_REGEXP = ".*Build/([^ \\)\\(]*).*";
     private Pattern buildHashPattern = Pattern.compile(BUILD_HASH_REGEXP);
     private Map<String, Device> devices;
-    private static final String[] FUZZY_TOKEN_REGEXPS = { "SM-T5\\d\\d" };
+//    private static final String[] FUZZY_TOKEN_REGEXPS = { "SM-T5\\d\\d" };
     protected static final Logger logger = LogManager.getLogger(AndroidDeviceBuilder.class);
     
     public AndroidDeviceBuilder() {
@@ -78,7 +76,8 @@ public class AndroidDeviceBuilder extend
         if (foundDevices.size() > 0) {
             Collections.sort(foundDevices, Collections.reverseOrder());
             return fixFromUserAgent(foundDevices.get(0), userAgent);
-        } else {
+        } /* else {
+            // should work via regex in BuilderDataSource.xml
         	if (confidenceTreshold <= ODDR_DEFAULT_THRESHOLD) {
         	// we only do this if confidence is at or below default threshold (otherwise a "closer"
result than this can offer is expected)
 	        	it = orderedRules.keySet().iterator(); // need it again for "Fuzzy" patterns
@@ -91,7 +90,7 @@ public class AndroidDeviceBuilder extend
 	        		}
 	        	}
         	}
-        }
+        } */
         return null;
     }
 
@@ -215,23 +214,23 @@ public class AndroidDeviceBuilder extend
         return null;
     }
     
-    private Device fuzzyAndroidDeviceWithToken(final UserAgent userAgent, String token) {
-        if (userAgent.hasMozillaPattern() || userAgent.hasOperaPattern()) {
-            int subtract = 1;
-	    	for (String regEx : FUZZY_TOKEN_REGEXPS) {
-	    		if (Pattern.matches(regEx, token)) {
-	    			String deviceId = (String) orderedRules.get(token);
-	                if (devices.containsKey(deviceId)) {
-	                    Device retDevice = (Device) devices.get(deviceId).clone();
-	                    retDevice.setConfidence(40 - subtract);
-	                    return retDevice;
-	                }
-	    		}
-	    		return null;
-	    	}
-        }
-    	return null;
-    }
+//    private Device fuzzyAndroidDeviceWithToken(final UserAgent userAgent, String token)
{
+//        if (userAgent.hasMozillaPattern() || userAgent.hasOperaPattern()) {
+//            int subtract = 1;
+//	    	for (String regEx : FUZZY_TOKEN_REGEXPS) {
+//	    		if (Pattern.matches(regEx, token)) {
+//	    			String deviceId = (String) orderedRules.get(token);
+//	                if (devices.containsKey(deviceId)) {
+//	                    Device retDevice = (Device) devices.get(deviceId).clone();
+//	                    retDevice.setConfidence(40 - subtract);
+//	                    return retDevice;
+//	                }
+//	    		}
+//	    		return null;
+//	    	}
+//        }
+//    	return null;
+//    }
     
     private Device fixFromUserAgent(final Device device, final UserAgent userAgent) {
 //    	if (device.containsProperty(DEVICE_OS_VERSION)) {



Mime
View raw message