Skip to content

Commit 4ec9aff

Browse files
committed
Polishing
1 parent d1303af commit 4ec9aff

File tree

3 files changed

+32
-38
lines changed

3 files changed

+32
-38
lines changed

spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
public class AnnotationMetadataTests {
5353

5454
@Test
55-
public void standardAnnotationMetadata() throws Exception {
55+
public void standardAnnotationMetadata() {
5656
AnnotationMetadata metadata = new StandardAnnotationMetadata(AnnotatedComponent.class, true);
5757
doTestAnnotationInfo(metadata);
5858
doTestMethodAnnotationInfo(metadata);
@@ -68,7 +68,7 @@ public void asmAnnotationMetadata() throws Exception {
6868
}
6969

7070
@Test
71-
public void standardAnnotationMetadataForSubclass() throws Exception {
71+
public void standardAnnotationMetadataForSubclass() {
7272
AnnotationMetadata metadata = new StandardAnnotationMetadata(AnnotatedComponentSubClass.class, true);
7373
doTestSubClassAnnotationInfo(metadata);
7474
}
@@ -104,7 +104,7 @@ private void doTestSubClassAnnotationInfo(AnnotationMetadata metadata) {
104104
}
105105

106106
@Test
107-
public void standardAnnotationMetadataForInterface() throws Exception {
107+
public void standardAnnotationMetadataForInterface() {
108108
AnnotationMetadata metadata = new StandardAnnotationMetadata(AnnotationMetadata.class, true);
109109
doTestMetadataForInterfaceClass(metadata);
110110
}
@@ -132,7 +132,7 @@ private void doTestMetadataForInterfaceClass(AnnotationMetadata metadata) {
132132
}
133133

134134
@Test
135-
public void standardAnnotationMetadataForAnnotation() throws Exception {
135+
public void standardAnnotationMetadataForAnnotation() {
136136
AnnotationMetadata metadata = new StandardAnnotationMetadata(Component.class, true);
137137
doTestMetadataForAnnotationClass(metadata);
138138
}
@@ -172,7 +172,7 @@ private void doTestMetadataForAnnotationClass(AnnotationMetadata metadata) {
172172
* 'true' as is done in the main test above.
173173
*/
174174
@Test
175-
public void standardAnnotationMetadata_nestedAnnotationsAsMap_false() throws Exception {
175+
public void standardAnnotationMetadata_nestedAnnotationsAsMap_false() {
176176
AnnotationMetadata metadata = new StandardAnnotationMetadata(AnnotatedComponent.class);
177177
AnnotationAttributes specialAttrs = (AnnotationAttributes) metadata.getAnnotationAttributes(SpecialAttr.class.getName());
178178
Annotation[] nestedAnnoArray = (Annotation[]) specialAttrs.get("nestedAnnoArray");

spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
2121
import java.util.LinkedHashMap;
2222
import java.util.Map;
2323
import java.util.Properties;
24-
import javax.servlet.ServletContext;
2524
import javax.servlet.http.HttpServletRequest;
2625

2726
import org.apache.commons.logging.Log;
@@ -34,7 +33,7 @@
3433

3534
/**
3635
* Helper class for URL path matching. Provides support for URL paths in
37-
* RequestDispatcher includes and support for consistent URL decoding.
36+
* {@code RequestDispatcher} includes and support for consistent URL decoding.
3837
*
3938
* <p>Used by {@link org.springframework.web.servlet.handler.AbstractUrlHandlerMapping}
4039
* and {@link org.springframework.web.servlet.support.RequestContext} for path matching
@@ -44,6 +43,8 @@
4443
* @author Rob Harrop
4544
* @author Rossen Stoyanchev
4645
* @since 14.01.2004
46+
* @see #getLookupPathForRequest
47+
* @see javax.servlet.RequestDispatcher
4748
*/
4849
public class UrlPathHelper {
4950

@@ -70,8 +71,9 @@ public class UrlPathHelper {
7071

7172

7273
/**
73-
* Whether URL lookups should always use the full path within current
74-
* application context, i.e. within {@link ServletContext#getContextPath()}.
74+
* Whether URL lookups should always use the full path within the current
75+
* web application context, i.e. within
76+
* {@link javax.servlet.ServletContext#getContextPath()}.
7577
* <p>If set to {@literal false} the path within the current servlet mapping
7678
* is used instead if applicable (i.e. in the case of a prefix based Servlet
7779
* mapping such as "/myServlet/*").
@@ -90,7 +92,7 @@ public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
9092
* <p>By default this is set to {@literal true}.
9193
* <p><strong>Note:</strong> Be aware the servlet path will not match when
9294
* compared to encoded paths. Therefore use of {@code urlDecode=false} is
93-
* not compatible with a prefix-based Servlet mappping and likewise implies
95+
* not compatible with a prefix-based Servlet mapping and likewise implies
9496
* also setting {@code alwaysUseFullPath=true}.
9597
* @see #getServletPath
9698
* @see #getContextPath
@@ -157,8 +159,8 @@ protected String getDefaultEncoding() {
157159
* <p>Detects include request URL if called within a RequestDispatcher include.
158160
* @param request current HTTP request
159161
* @return the lookup path
160-
* @see #getPathWithinApplication
161162
* @see #getPathWithinServletMapping
163+
* @see #getPathWithinApplication
162164
*/
163165
public String getLookupPathForRequest(HttpServletRequest request) {
164166
// Always use full path within current servlet context?
@@ -187,6 +189,7 @@ public String getLookupPathForRequest(HttpServletRequest request) {
187189
* <p>E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
188190
* @param request current HTTP request
189191
* @return the path within the servlet mapping, or ""
192+
* @see #getLookupPathForRequest
190193
*/
191194
public String getPathWithinServletMapping(HttpServletRequest request) {
192195
String pathWithinApp = getPathWithinApplication(request);
@@ -234,6 +237,7 @@ public String getPathWithinServletMapping(HttpServletRequest request) {
234237
* <p>Detects include request URL if called within a RequestDispatcher include.
235238
* @param request current HTTP request
236239
* @return the path within the web application
240+
* @see #getLookupPathForRequest
237241
*/
238242
public String getPathWithinApplication(HttpServletRequest request) {
239243
String contextPath = getContextPath(request);
@@ -288,7 +292,7 @@ else if (index1 == requestUri.length()) {
288292
/**
289293
* Sanitize the given path. Uses the following rules:
290294
* <ul>
291-
* <li>replace all "//" by "/"</li>
295+
* <li>replace all "//" by "/"</li>
292296
* </ul>
293297
*/
294298
private String getSanitizedPath(final String path) {
@@ -492,8 +496,8 @@ protected String determineEncoding(HttpServletRequest request) {
492496

493497
/**
494498
* Remove ";" (semicolon) content from the given request URI if the
495-
* {@linkplain #setRemoveSemicolonContent(boolean) removeSemicolonContent}
496-
* property is set to "true". Note that "jssessionid" is always removed.
499+
* {@linkplain #setRemoveSemicolonContent removeSemicolonContent}
500+
* property is set to "true". Note that "jsessionid" is always removed.
497501
* @param requestUri the request URI string to remove ";" content from
498502
* @return the updated URI string
499503
*/
@@ -524,12 +528,10 @@ private String removeJsessionid(String requestUri) {
524528
}
525529

526530
/**
527-
* Decode the given URI path variables via
528-
* {@link #decodeRequestString(HttpServletRequest, String)} unless
529-
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
530-
* assumed the URL path from which the variables were extracted is already
531-
* decoded through a call to
532-
* {@link #getLookupPathForRequest(HttpServletRequest)}.
531+
* Decode the given URI path variables via {@link #decodeRequestString} unless
532+
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
533+
* the URL path from which the variables were extracted is already decoded
534+
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
533535
* @param request current HTTP request
534536
* @param vars the URI variables extracted from the URL path
535537
* @return the same Map or a new Map instance
@@ -546,18 +548,16 @@ public Map<String, String> decodePathVariables(HttpServletRequest request, Map<S
546548
}
547549

548550
/**
549-
* Decode the given matrix variables via
550-
* {@link #decodeRequestString(HttpServletRequest, String)} unless
551-
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
552-
* assumed the URL path from which the variables were extracted is already
553-
* decoded through a call to
554-
* {@link #getLookupPathForRequest(HttpServletRequest)}.
551+
* Decode the given matrix variables via {@link #decodeRequestString} unless
552+
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
553+
* the URL path from which the variables were extracted is already decoded
554+
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
555555
* @param request current HTTP request
556556
* @param vars the URI variables extracted from the URL path
557557
* @return the same Map or a new Map instance
558558
*/
559-
public MultiValueMap<String, String> decodeMatrixVariables(HttpServletRequest request,
560-
MultiValueMap<String, String> vars) {
559+
public MultiValueMap<String, String> decodeMatrixVariables(
560+
HttpServletRequest request, MultiValueMap<String, String> vars) {
561561

562562
if (this.urlDecode) {
563563
return vars;

spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,8 @@
8383
import org.springframework.beans.FatalBeanException;
8484
import org.springframework.util.StringUtils;
8585

86-
import static org.hamcrest.Matchers.containsString;
87-
import static org.hamcrest.Matchers.not;
88-
import static org.junit.Assert.assertEquals;
89-
import static org.junit.Assert.assertFalse;
90-
import static org.junit.Assert.assertNotNull;
91-
import static org.junit.Assert.assertNull;
92-
import static org.junit.Assert.assertSame;
93-
import static org.junit.Assert.assertThat;
94-
import static org.junit.Assert.assertTrue;
86+
import static org.hamcrest.Matchers.*;
87+
import static org.junit.Assert.*;
9588

9689
/**
9790
* Test class for {@link Jackson2ObjectMapperBuilder}.
@@ -695,6 +688,7 @@ public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
695688

696689
}
697690

691+
@SuppressWarnings("serial")
698692
public static class MyXmlFactory extends XmlFactory {
699693
}
700694

0 commit comments

Comments
 (0)