Skip to content

Commit 9520a59

Browse files
committed
Polishing
1 parent 6924f00 commit 9520a59

File tree

7 files changed

+29
-26
lines changed

7 files changed

+29
-26
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

Lines changed: 12 additions & 12 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.
@@ -93,7 +93,7 @@ final class CglibAopProxy implements AopProxy, Serializable {
9393

9494

9595
/** Logger available to subclasses; static to optimize serialization */
96-
protected final static Log logger = LogFactory.getLog(CglibAopProxy.class);
96+
protected static final Log logger = LogFactory.getLog(CglibAopProxy.class);
9797

9898
/** Keeps track of the Classes that we have validated for final methods */
9999
private static final Map<Class<?>, Boolean> validatedClasses = new WeakHashMap<Class<?>, Boolean>();
@@ -294,13 +294,13 @@ private Callback[] getCallbacks(Class<?> rootClass) throws Exception {
294294
Callback targetDispatcher = isStatic ?
295295
new StaticDispatcher(this.advised.getTargetSource().getTarget()) : new SerializableNoOp();
296296

297-
Callback[] mainCallbacks = new Callback[]{
298-
aopInterceptor, // for normal advice
299-
targetInterceptor, // invoke target without considering advice, if optimized
300-
new SerializableNoOp(), // no override for methods mapped to this
301-
targetDispatcher, this.advisedDispatcher,
302-
new EqualsInterceptor(this.advised),
303-
new HashCodeInterceptor(this.advised)
297+
Callback[] mainCallbacks = new Callback[] {
298+
aopInterceptor, // for normal advice
299+
targetInterceptor, // invoke target without considering advice, if optimized
300+
new SerializableNoOp(), // no override for methods mapped to this
301+
targetDispatcher, this.advisedDispatcher,
302+
new EqualsInterceptor(this.advised),
303+
new HashCodeInterceptor(this.advised)
304304
};
305305

306306
Callback[] callbacks;
@@ -678,10 +678,11 @@ private static class CglibMethodInvocation extends ReflectiveMethodInvocation {
678678

679679
private final MethodProxy methodProxy;
680680

681-
private boolean protectedMethod;
681+
private final boolean protectedMethod;
682682

683683
public CglibMethodInvocation(Object proxy, Object target, Method method, Object[] arguments,
684684
Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers, MethodProxy methodProxy) {
685+
685686
super(proxy, target, method, arguments, targetClass, interceptorsAndDynamicMethodMatchers);
686687
this.methodProxy = methodProxy;
687688
this.protectedMethod = Modifier.isProtected(method.getModifiers());
@@ -800,8 +801,7 @@ public int accept(Method method) {
800801
if (logger.isDebugEnabled()) {
801802
logger.debug("Method has advice and optimisations are enabled: " + method);
802803
}
803-
// We know that we are optimising so we can use the
804-
// FixedStaticChainInterceptors.
804+
// We know that we are optimising so we can use the FixedStaticChainInterceptors.
805805
int index = this.fixedInterceptorMap.get(key);
806806
return (index + this.fixedInterceptorOffset);
807807
}

spring-test-mvc/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.test.web.client;
1818

19-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;
20-
2119
import java.io.IOException;
2220
import java.net.URI;
2321
import java.util.List;
@@ -36,6 +34,8 @@
3634
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
3735
import org.springframework.util.Assert;
3836

37+
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
38+
3939
/**
4040
* A {@link ClientHttpRequestFactory} for requests executed via {@link MockMvc}.
4141
*

spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.test.web.client;
1718

1819
import java.io.IOException;

spring-test-mvc/src/main/java/org/springframework/test/web/client/RequestMatcherClientHttpRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.test.web.client;
1718

1819
import java.io.IOException;

spring-test-mvc/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.test.web.client.match;
1716

18-
import static org.springframework.test.util.AssertionErrors.assertEquals;
19-
import static org.springframework.test.util.AssertionErrors.assertTrue;
20-
import static org.springframework.test.util.MatcherAssertionErrors.assertThat;
17+
package org.springframework.test.web.client.match;
2118

2219
import java.io.IOException;
23-
2420
import javax.xml.transform.Source;
2521
import javax.xml.transform.dom.DOMSource;
2622

2723
import org.hamcrest.Matcher;
24+
import org.w3c.dom.Node;
25+
2826
import org.springframework.http.MediaType;
2927
import org.springframework.http.client.ClientHttpRequest;
3028
import org.springframework.mock.http.client.MockClientHttpRequest;
3129
import org.springframework.test.util.XmlExpectationsHelper;
3230
import org.springframework.test.web.client.RequestMatcher;
33-
import org.w3c.dom.Node;
31+
32+
import static org.hamcrest.MatcherAssert.*;
33+
import static org.springframework.test.util.AssertionErrors.*;
3434

3535
/**
3636
* Factory for request content {@code RequestMatcher}'s. An instance of this
@@ -185,8 +185,8 @@ public final void match(ClientHttpRequest request) throws IOException, Assertion
185185
MockClientHttpRequest mockRequest = (MockClientHttpRequest) request;
186186
matchInternal(mockRequest);
187187
}
188-
catch (Exception e) {
189-
throw new AssertionError("Failed to parse expected or actual XML request content: " + e.getMessage());
188+
catch (Exception ex) {
189+
throw new AssertionError("Failed to parse expected or actual XML request content: " + ex.getMessage());
190190
}
191191
}
192192

spring-test-mvc/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.test.web.client.match;
1718

1819
import java.io.IOException;
1920
import java.text.ParseException;
2021

2122
import org.hamcrest.Matcher;
23+
2224
import org.springframework.http.client.ClientHttpRequest;
2325
import org.springframework.mock.http.client.MockClientHttpRequest;
2426
import org.springframework.test.util.JsonPathExpectationsHelper;
@@ -51,6 +53,7 @@ protected JsonPathRequestMatchers(String expression, Object ... args) {
5153
this.jsonPathHelper = new JsonPathExpectationsHelper(expression, args);
5254
}
5355

56+
5457
/**
5558
* Evaluate the JSONPath and assert the resulting value with the given {@code Matcher}.
5659
*/

spring-test-mvc/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,19 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package org.springframework.test.web.client.match;
1817

1918
import java.io.IOException;
2019
import java.util.Map;
21-
2220
import javax.xml.xpath.XPathExpressionException;
2321

2422
import org.hamcrest.Matcher;
23+
import org.w3c.dom.Node;
24+
2525
import org.springframework.http.client.ClientHttpRequest;
2626
import org.springframework.mock.http.client.MockClientHttpRequest;
2727
import org.springframework.test.util.XpathExpectationsHelper;
2828
import org.springframework.test.web.client.RequestMatcher;
29-
import org.w3c.dom.Node;
3029

3130
/**
3231
* Factory methods for request content {@code RequestMatcher}'s using an XPath
@@ -196,7 +195,6 @@ public final void match(ClientHttpRequest request) throws IOException, Assertion
196195
}
197196

198197
protected abstract void matchInternal(MockClientHttpRequest request) throws Exception;
199-
200198
}
201199

202200
}

0 commit comments

Comments
 (0)