You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mu...@apache.org on 2010/10/15 02:03:49 UTC

svn commit: r1022774 - /myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java

Author: muthaman
Date: Fri Oct 15 00:03:49 2010
New Revision: 1022774

URL: http://svn.apache.org/viewvc?rev=1022774&view=rev
Log:
TRINIDAD-1933 - Handling Windows Mobile 6.5 browser

Modified:
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java?rev=1022774&r1=1022773&r2=1022774&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java Fri Oct 15 00:03:49 2010
@@ -382,12 +382,31 @@ public class AgentFactoryImpl implements
    */
   private void _populatePocketPCAgentImpl(String agent,String uaPixels,AgentImpl agentObj)
   {
-    int start = agent.indexOf("MSIE");
+
+    // The latest Windows-Mobile user-agents have different formats, so we
+    // need to have two difference logics to handle both older and newer 
+    // WM browsers.    
+    // Latest WM browsers have version detail assiciated with "IEMobile"
+    int start = agent.indexOf("IEMobile");
+    
+    int length;
+    
+    // If "IEMobile" not present, use the legacy "MSIE"
+    if (start < 0)
+    {
+      start = agent.indexOf("MSIE");
+      length = "MSIE".length();
+    }
+    else
+    {
+      length = "IEMobile".length();
+    }
+
     String version = null;
 
     if (start > -1)
     {
-      version = _getVersion(agent, start + "MSIE".length());
+      version = _getVersion(agent, start + length);
     }
     agentObj.setType(Agent.TYPE_PDA);
     agentObj.setAgent(Agent.AGENT_IE);