Author: mgrigorov
Date: Mon May 16 19:13:41 2011
New Revision: 1103849
URL: http://svn.apache.org/viewvc?rev=1103849&view=rev
Log:
WICKET-3713 org/apache/wicket/protocol/http/request/UserAgent matches method is
not correct
Initialize the 'not allowed list' just once in the ctor instead in each method
of matches().
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/request/UserAgent.java
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/request/UserAgent.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/request/UserAgent.java?rev=1103849&r1=1103848&r2=1103849&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/request/UserAgent.java
(original)
+++
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/request/UserAgent.java
Mon May 16 19:13:41 2011
@@ -42,9 +42,9 @@ enum UserAgent {
KONQUEROR(Arrays.asList("Konqueror"));
/**
- * Comma separated list with values which are not allowed in the user
agent.
+ * The values which are not allowed in the user agent.
*/
- private final String notAllowed;
+ private final String[] notAllowedList;
/**
* A list with strings which has to be in the user agent string.
@@ -61,7 +61,7 @@ enum UserAgent {
*/
UserAgent(String notAllowed, List<String>... detectionStrings)
{
- this.notAllowed = notAllowed;
+ notAllowedList = Strings.split(notAllowed, ',');
this.detectionStrings = detectionStrings;
}
@@ -83,9 +83,8 @@ enum UserAgent {
*/
public boolean matches(String userAgent)
{
- if (Strings.isEmpty(notAllowed) == false)
+ if (notAllowedList != null)
{
- String[] notAllowedList = Strings.split(notAllowed,
',');
for (String value : notAllowedList)
{
if (userAgent.contains(value))