diff --git a/org.springframework.core/src/main/java/org/springframework/util/AntPatchStringMatcher.java b/org.springframework.core/src/main/java/org/springframework/util/AntPatchStringMatcher.java index b747bee726f..2bee2e4e4f8 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/AntPatchStringMatcher.java +++ b/org.springframework.core/src/main/java/org/springframework/util/AntPatchStringMatcher.java @@ -1,11 +1,29 @@ +/* + * Copyright 2002-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.util; import java.util.Map; /** - * Package-protected helper class for {@link AntPathMatcher}. Tests whether or not a string matches against a pattern. - * The pattern may contain special characters:
'*' means zero or more characters
'?' means one and only one - * character, '{' and '}' indicate a uri template pattern + * Package-protected helper class for {@link AntPathMatcher}. + * Tests whether or not a string matches against a pattern. + * + *

The pattern may contain special characters: '*' means zero or more characters; + * '?' means one and only one character; '{' and '}' indicate a URI template pattern. * * @author Arjen Poutsma * @since 3.0 @@ -28,29 +46,24 @@ class AntPatchStringMatcher { private final Map uriTemplateVariables; - /** Constructs a new instance of the AntPatchStringMatcher. */ - AntPatchStringMatcher(String pattern, String str, Map uriTemplateVariables) { - patArr = pattern.toCharArray(); - strArr = str.toCharArray(); + + /** + * Construct a new instance of the AntPatchStringMatcher. + */ + public AntPatchStringMatcher(String pattern, String str, Map uriTemplateVariables) { + this.patArr = pattern.toCharArray(); + this.strArr = str.toCharArray(); + this.patIdxEnd = this.patArr.length - 1; + this.strIdxEnd = this.strArr.length - 1; this.uriTemplateVariables = uriTemplateVariables; - patIdxEnd = patArr.length - 1; - strIdxEnd = strArr.length - 1; } - private void addTemplateVariable(int curlyIdxStart, int curlyIdxEnd, int valIdxStart, int valIdxEnd) { - if (uriTemplateVariables != null) { - String varName = new String(patArr, curlyIdxStart + 1, curlyIdxEnd - curlyIdxStart - 1); - String varValue = new String(strArr, valIdxStart, valIdxEnd - valIdxStart + 1); - uriTemplateVariables.put(varName, varValue); - } - } /** * Main entry point. - * * @return true if the string matches against the pattern, or false otherwise. */ - boolean matchStrings() { + public boolean matchStrings() { if (shortcutPossible()) { return doShortcut(); } @@ -119,6 +132,14 @@ class AntPatchStringMatcher { return onlyStarsLeft(); } + private void addTemplateVariable(int curlyIdxStart, int curlyIdxEnd, int valIdxStart, int valIdxEnd) { + if (uriTemplateVariables != null) { + String varName = new String(patArr, curlyIdxStart + 1, curlyIdxEnd - curlyIdxStart - 1); + String varValue = new String(strArr, valIdxStart, valIdxEnd - valIdxStart + 1); + uriTemplateVariables.put(varName, varValue); + } + } + private boolean consecutiveStars(int patIdxTmp) { if (patIdxTmp == patIdxStart + 1 && patArr[patIdxStart] == '*' && patArr[patIdxTmp] == '*') { // Two stars next to each other, skip the first one. diff --git a/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java b/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java index 7ba4d8b6f3a..f758e412a2f 100644 --- a/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java +++ b/org.springframework.core/src/main/java/org/springframework/util/CachingMapDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ public class CachingMapDecorator implements Map, Serializable { */ @SuppressWarnings("unchecked") public CachingMapDecorator(Map targetMap, boolean synchronize, boolean weak) { - Assert.notNull(targetMap, "Target Map is required"); + Assert.notNull(targetMap, "'targetMap' must not be null"); this.targetMap = (Map) (synchronize ? Collections.synchronizedMap(targetMap) : targetMap); this.synchronize = synchronize; this.weak = weak; diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java index 91218e4f817..3695cb34251 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,6 @@ package org.springframework.web.bind.annotation; */ public enum RequestMethod { - GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE; + GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE }