Skip to content

Commit 667fc7e

Browse files
committed
Polishing
1 parent 811de8e commit 667fc7e

File tree

12 files changed

+32
-37
lines changed

12 files changed

+32
-37
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,17 +393,14 @@ public enum ResolutionMethod {
393393
*/
394394
protected static class StrictMapAppenderConstructor extends Constructor {
395395

396-
public StrictMapAppenderConstructor() {
397-
super();
398-
}
399-
400396
@Override
401397
protected Map<Object, Object> constructMapping(MappingNode node) {
402398
try {
403399
return super.constructMapping(node);
404-
} catch (IllegalStateException e) {
400+
}
401+
catch (IllegalStateException ex) {
405402
throw new ParserException("while parsing MappingNode",
406-
node.getStartMark(), e.getMessage(), node.getEndMark());
403+
node.getStartMark(), ex.getMessage(), node.getEndMark());
407404
}
408405
}
409406

@@ -414,7 +411,7 @@ protected Map<Object, Object> createDefaultMap() {
414411
@Override
415412
public Object put(Object key, Object value) {
416413
if (delegate.containsKey(key)) {
417-
throw new IllegalStateException("duplicate key: " + key);
414+
throw new IllegalStateException("Duplicate key: " + key);
418415
}
419416
return delegate.put(key, value);
420417
}

spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -80,13 +80,14 @@ private Class<?> discoverPublicClass(Method method, Class<?> clazz) {
8080
try {
8181
clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
8282
return clazz;
83-
} catch (NoSuchMethodException nsme) {
84-
83+
}
84+
catch (NoSuchMethodException ex) {
85+
// Continue below...
8586
}
8687
}
87-
Class<?>[] intfaces = clazz.getInterfaces();
88-
for (Class<?> intface: intfaces) {
89-
discoverPublicClass(method, intface);
88+
Class<?>[] ifcs = clazz.getInterfaces();
89+
for (Class<?> ifc: ifcs) {
90+
discoverPublicClass(method, ifc);
9091
}
9192
if (clazz.getSuperclass() != null) {
9293
return discoverPublicClass(method, clazz.getSuperclass());

spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ public class StompDecoder {
5858

5959

6060
/**
61-
* Configure a
62-
* {@link org.springframework.messaging.support.MessageHeaderInitializer MessageHeaderInitializer}
63-
* to apply to the headers of {@link Message}s from decoded STOMP frames.
61+
* Configure a {@link MessageHeaderInitializer} to apply to the headers of
62+
* {@link Message}s from decoded STOMP frames.
6463
*/
6564
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) {
6665
this.headerInitializer = headerInitializer;
@@ -216,7 +215,7 @@ private void readHeaders(ByteBuffer buffer, StompHeaderAccessor headerAccessor)
216215
String header = new String(headerStream.toByteArray(), UTF8_CHARSET);
217216
int colonIndex = header.indexOf(':');
218217
if (colonIndex <= 0) {
219-
if(buffer.remaining() > 0) {
218+
if (buffer.remaining() > 0) {
220219
throw new StompConversionException("Illegal header: '" + header +
221220
"'. A header must be of the form <name>:[<value>].");
222221
}

spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import java.util.Locale;
3434
import java.util.Map;
3535
import java.util.TimeZone;
36-
3736
import javax.servlet.ServletOutputStream;
3837
import javax.servlet.http.Cookie;
3938
import javax.servlet.http.HttpServletResponse;
@@ -499,7 +498,8 @@ public long getDateHeader(String name) {
499498
dateFormat.setTimeZone(GMT);
500499
try {
501500
return dateFormat.parse(getHeader(name)).getTime();
502-
} catch (ParseException exception) {
501+
}
502+
catch (ParseException ex) {
503503
throw new IllegalArgumentException(
504504
"Value for header '" + name + "' is not a valid Date: " + getHeader(name));
505505
}

spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/ResponseBodyTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -38,22 +38,21 @@ public class ResponseBodyTests {
3838

3939
@Test
4040
public void json() throws Exception {
41-
4241
standaloneSetup(new PersonController()).build()
43-
.perform(get("/person/Lee").accept(MediaType.APPLICATION_JSON))
42+
.perform(get("/person/Lee").accept(MediaType.APPLICATION_JSON))
4443
.andExpect(status().isOk())
4544
.andExpect(content().contentType("application/json;charset=UTF-8"))
4645
.andExpect(jsonPath("$.name").value("Lee"));
4746
}
4847

48+
4949
@Controller
5050
private class PersonController {
5151

5252
@RequestMapping(value="/person/{name}")
5353
@ResponseBody
5454
public Person get(@PathVariable String name) {
55-
Person person = new Person(name);
56-
return person;
55+
return new Person(name);
5756
}
5857
}
5958

spring-web/src/main/java/org/springframework/http/ResponseEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ public BodyBuilder contentType(MediaType contentType) {
422422
@Override
423423
public BodyBuilder eTag(String eTag) {
424424
if (eTag != null) {
425-
if(!eTag.startsWith("\"") && !eTag.startsWith("W/\"")) {
425+
if (!eTag.startsWith("\"") && !eTag.startsWith("W/\"")) {
426426
eTag = "\"" + eTag;
427427
}
428-
if(!eTag.endsWith("\"")) {
428+
if (!eTag.endsWith("\"")) {
429429
eTag = eTag + "\"";
430430
}
431431
}

spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -234,7 +234,7 @@ public void afterPropertiesSet() {
234234
strategies.add(new HeaderContentNegotiationStrategy());
235235
}
236236

237-
if(this.defaultNegotiationStrategy != null) {
237+
if (this.defaultNegotiationStrategy != null) {
238238
strategies.add(defaultNegotiationStrategy);
239239
}
240240

spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public HttpMessageConverterExtractor(Type responseType, List<HttpMessageConverte
8080
public T extractData(ClientHttpResponse response) throws IOException {
8181

8282
MessageBodyClientHttpResponseWrapper responseWrapper = new MessageBodyClientHttpResponseWrapper(response);
83-
if(!responseWrapper.hasMessageBody() || responseWrapper.hasEmptyMessageBody()) {
83+
if (!responseWrapper.hasMessageBody() || responseWrapper.hasEmptyMessageBody()) {
8484
return null;
8585
}
8686
MediaType contentType = getContentType(responseWrapper);

spring-web/src/main/java/org/springframework/web/client/MessageBodyClientHttpResponseWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public boolean hasMessageBody() throws IOException {
6161
responseStatus == HttpStatus.NOT_MODIFIED) {
6262
return false;
6363
}
64-
else if(this.getHeaders().getContentLength() == 0) {
64+
else if (this.getHeaders().getContentLength() == 0) {
6565
return false;
6666
}
6767
return true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -180,7 +180,7 @@ public String getPathWithinServletMapping(HttpServletRequest request) {
180180
String path;
181181

182182
// if the app container sanitized the servletPath, check against the sanitized version
183-
if(servletPath.indexOf(sanitizedPathWithinApp) != -1) {
183+
if (servletPath.indexOf(sanitizedPathWithinApp) != -1) {
184184
path = getRemainingPath(sanitizedPathWithinApp, servletPath, false);
185185
}
186186
else {

0 commit comments

Comments
 (0)