You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/04/13 19:41:48 UTC

svn commit: r528564 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java

Author: ehillenius
Date: Fri Apr 13 10:41:48 2007
New Revision: 528564

URL: http://svn.apache.org/viewvc?view=rev&rev=528564
Log:
fix to allow null. maybe we need a better fix. see http://www.nabble.com/WebClientInfo-throws-exception-when-User-Agent-is-not-set%2C-but-should-it--tf3572433.html

Modified:
    incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java

Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java?view=diff&rev=528564&r1=528563&r2=528564
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java Fri Apr 13 10:41:48 2007
@@ -20,7 +20,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.protocol.http.ClientProperties;
 import org.apache.wicket.protocol.http.WebRequestCycle;
 import org.apache.wicket.request.ClientInfo;
@@ -61,10 +60,6 @@
 		HttpServletRequest httpServletRequest = requestCycle.getWebRequest()
 				.getHttpServletRequest();
 		userAgent = httpServletRequest.getHeader("User-Agent");
-		if (userAgent == null)
-		{
-			throw new WicketRuntimeException("unable to read header 'User-Agent'");
-		}
 		properties.setRemoteAddress(httpServletRequest.getRemoteAddr());
 		init();
 	}
@@ -80,12 +75,6 @@
 	public WebClientInfo(WebRequestCycle requestCycle, String userAgent)
 	{
 		super();
-
-		if (userAgent == null)
-		{
-			throw new WicketRuntimeException("user agent must be provided");
-		}
-
 		this.userAgent = userAgent;
 		HttpServletRequest httpServletRequest = requestCycle.getWebRequest()
 				.getHttpServletRequest();
@@ -118,7 +107,7 @@
 	 */
 	private final void init()
 	{
-		String userAgent = getUserAgent().toLowerCase();
+		String userAgent = (getUserAgent() != null) ? getUserAgent().toLowerCase() : "";
 
 		boolean browserOpera = userAgent.indexOf("opera") != -1;
 		boolean browserSafari = userAgent.indexOf("safari") != -1;