myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckor...@apache.org
Subject svn commit: r820104 - in /myfaces/trinidad/trunk: trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/
Date Tue, 29 Sep 2009 21:59:10 GMT
Author: ckormos
Date: Tue Sep 29 21:59:10 2009
New Revision: 820104

URL: http://svn.apache.org/viewvc?rev=820104&view=rev
Log:
fix for [TRINIDAD-1520] - NPE from Google Bot (unknown agent) - by default, the properties
of AgentImpl initialized with "unknown" values.

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java?rev=820104&r1=820103&r2=820104&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
Tue Sep 29 21:59:10 2009
@@ -61,6 +61,11 @@
    */
   public static final Object TYPE_PHONE = "phone";
 
+ /**
+   * Constant for Unknown platform
+   */
+  public static final String PLATFORM_UNKNOWN = "unknown";
+
   /**
    * Constant for windows platform
    */
@@ -120,6 +125,11 @@
   public static final String PLATFORM_GENERICPDA = "genericpda";
 
   /**
+   * Constant for Unknown platform version
+   */
+  public static final String PLATFORM_VERSION_UNKNOWN = "unknown";
+
+  /**
    * Constant for when the agent is not supported or not recognized
    */
   public static final String AGENT_UNKNOWN = "unknown";
@@ -170,6 +180,16 @@
   public static final String AGENT_GENERICPDA = "genericpda";
 
   /**
+   * Constant for Unknown Agent version
+   */
+  public static final String AGENT_VERSION_UNKNOWN = "unknown";
+
+  /**
+   * Constant for Unknown make model version
+   */
+  public static final String MAKE_MODEL_UNKNOWN = "unknown";
+
+  /**
    *
    * @return return the Type of Agent. Returns <code>TYPE_UNKNOWN</code> if not
available.
    * <br>E.g. desktop, pda, phone

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java?rev=820104&r1=820103&r2=820104&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentFactoryImpl.java
Tue Sep 29 21:59:10 2009
@@ -104,11 +104,7 @@
       return;
     }
 
-    if (userAgent == null)
-    {
-      _populateUnknownAgentImpl(null, agent);
-      return;
-    }
+   
 
     //the useragent string for telnet and PDA design time will start with
     //OracleJDevMobile because in each of these cases we know we have an
@@ -263,13 +259,7 @@
   {
     // Log warning message that we are setting the agent entry to unknown attributes
     _LOG.warning("UNKNOWN_AGENT_ATTRIBUTES_CREATE_WITH_UNKNOWN", userAgent);
-    agent.setAgentEntryToNULL();
-    agent.setAgent(Agent.AGENT_UNKNOWN);
-    agent.setType(_UNKNOWN);
-    agent.setAgentVersion(_UNKNOWN);
-    agent.setPlatform(_UNKNOWN);
-    agent.setPlatformVersion(_UNKNOWN);
-    agent.setMakeModel(_UNKNOWN);
+    agent.setAgentEntryToNULL();   
   }
 
   //populates the agent entry for DT access for either Telnet or PDA
@@ -912,9 +902,9 @@
 
     agentObj.setAgent(Agent.AGENT_EMAIL);
     agentObj.setAgentVersion("0.0");
-    agentObj.setPlatform(_UNKNOWN);
-    agentObj.setPlatformVersion(_UNKNOWN);
-    agentObj.setMakeModel(_UNKNOWN);
+    agentObj.setPlatform(Agent.AGENT_UNKNOWN);
+    agentObj.setPlatformVersion(Agent.PLATFORM_VERSION_UNKNOWN);
+    agentObj.setMakeModel(Agent.MAKE_MODEL_UNKNOWN);
 
   }  
 
@@ -977,8 +967,7 @@
   }
   static private final String _EMAIL_PARAM =
     "org.apache.myfaces.trinidad.agent.email";
-  static final private String _IASW_DEVICE_HINT_PARAM = "X-Oracle-Device.Class";
-  static final private String _UNKNOWN = "unknown";
+  static final private String _IASW_DEVICE_HINT_PARAM = "X-Oracle-Device.Class";  
   static final private TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(AgentFactoryImpl.class);
 
 }

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java?rev=820104&r1=820103&r2=820104&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java
Tue Sep 29 21:59:10 2009
@@ -146,11 +146,11 @@
   private static class AgentEntry
   {
     Object _type = TYPE_UNKNOWN;
-    String _agent;
-    String _agentVersion;
-    String _platform;
-    String _platformVersion;
-    String _makeModel;
+    String _agent = AGENT_UNKNOWN;
+    String _agentVersion = AGENT_VERSION_UNKNOWN;
+    String _platform = PLATFORM_UNKNOWN;
+    String _platformVersion = PLATFORM_VERSION_UNKNOWN;
+    String _makeModel = MAKE_MODEL_UNKNOWN;
   }
 
   void __addRequestCapability(CapabilityKey key,Object value)



Mime
View raw message