Skip to content

Commit ba0c48b

Browse files
committed
Polishing
1 parent 82dbde1 commit ba0c48b

File tree

7 files changed

+37
-51
lines changed

7 files changed

+37
-51
lines changed

spring-core/src/main/java/org/springframework/util/SocketUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 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.
@@ -73,7 +73,6 @@ public class SocketUtils {
7373
* &lt;bean id="bean2" ... p:port="#{socketUtils.findAvailableTcpPort(30000)}" /&gt;</code></pre>
7474
*/
7575
public SocketUtils() {
76-
/* no-op */
7776
}
7877

7978

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ResourceDatabasePopulator.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 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.
@@ -76,7 +76,6 @@ public class ResourceDatabasePopulator implements DatabasePopulator {
7676
* @since 4.0.3
7777
*/
7878
public ResourceDatabasePopulator() {
79-
/* no-op */
8079
}
8180

8281
/**
@@ -87,7 +86,6 @@ public ResourceDatabasePopulator() {
8786
* @since 4.0.3
8887
*/
8988
public ResourceDatabasePopulator(Resource... scripts) {
90-
this();
9189
setScripts(scripts);
9290
}
9391

@@ -97,19 +95,19 @@ public ResourceDatabasePopulator(Resource... scripts) {
9795
* logged but not cause a failure
9896
* @param ignoreFailedDrops flag to indicate that a failed SQL {@code DROP}
9997
* statement can be ignored
100-
* @param sqlScriptEncoding the encoding for the supplied SQL scripts; may
101-
* be {@code null} or <em>empty</em> to indicate platform encoding
98+
* @param sqlScriptEncoding the encoding for the supplied SQL scripts
99+
* (may be {@code null} or <em>empty</em> to indicate platform encoding)
102100
* @param scripts the scripts to execute to initialize or clean up the database
103101
* (never {@code null})
104102
* @since 4.0.3
105103
*/
106104
public ResourceDatabasePopulator(boolean continueOnError, boolean ignoreFailedDrops,
107105
@Nullable String sqlScriptEncoding, Resource... scripts) {
108106

109-
this(scripts);
110107
this.continueOnError = continueOnError;
111108
this.ignoreFailedDrops = ignoreFailedDrops;
112109
setSqlScriptEncoding(sqlScriptEncoding);
110+
setScripts(scripts);
113111
}
114112

115113

@@ -148,10 +146,10 @@ private void assertContentsOfScriptArray(Resource... scripts) {
148146
}
149147

150148
/**
151-
* Specify the encoding for the configured SQL scripts, if different from the
152-
* platform encoding.
153-
* @param sqlScriptEncoding the encoding used in scripts; may be {@code null}
154-
* or empty to indicate platform encoding
149+
* Specify the encoding for the configured SQL scripts,
150+
* if different from the platform encoding.
151+
* @param sqlScriptEncoding the encoding used in scripts
152+
* (may be {@code null} or empty to indicate platform encoding)
155153
* @see #addScript(Resource)
156154
*/
157155
public void setSqlScriptEncoding(@Nullable String sqlScriptEncoding) {

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java

Lines changed: 20 additions & 21 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.
@@ -107,7 +107,7 @@ public abstract class ScriptUtils {
107107
* in a block comment will be omitted from the output. In addition, multiple
108108
* adjacent whitespace characters will be collapsed into a single space.
109109
* @param script the SQL script
110-
* @param separator character separating each statement &mdash; typically a ';'
110+
* @param separator character separating each statement (typically a ';')
111111
* @param statements the list that will contain the individual statements
112112
* @throws ScriptException if an error occurred while splitting the SQL script
113113
* @see #splitSqlScript(String, String, List)
@@ -130,7 +130,8 @@ public static void splitSqlScript(String script, char separator, List<String> st
130130
* in a block comment will be omitted from the output. In addition, multiple
131131
* adjacent whitespace characters will be collapsed into a single space.
132132
* @param script the SQL script
133-
* @param separator text separating each statement &mdash; typically a ';' or newline character
133+
* @param separator text separating each statement
134+
* (typically a ';' or newline character)
134135
* @param statements the list that will contain the individual statements
135136
* @throws ScriptException if an error occurred while splitting the SQL script
136137
* @see #splitSqlScript(String, char, List)
@@ -153,11 +154,11 @@ public static void splitSqlScript(String script, String separator, List<String>
153154
* omitted from the output. In addition, multiple adjacent whitespace characters
154155
* will be collapsed into a single space.
155156
* @param resource the resource from which the script was read
156-
* @param script the SQL script; never {@code null} or empty
157-
* @param separator text separating each statement &mdash; typically a ';' or
158-
* newline character; never {@code null}
159-
* @param commentPrefix the prefix that identifies SQL line comments &mdash;
160-
* typically "--"; never {@code null} or empty
157+
* @param script the SQL script
158+
* @param separator text separating each statement
159+
* (typically a ';' or newline character)
160+
* @param commentPrefix the prefix that identifies SQL line comments
161+
* (typically "--")
161162
* @param blockCommentStartDelimiter the <em>start</em> block comment delimiter;
162163
* never {@code null} or empty
163164
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter;
@@ -270,15 +271,15 @@ static String readScript(EncodedResource resource) throws IOException {
270271
* a statement &mdash; will be included in the results.
271272
* @param resource the {@code EncodedResource} containing the script
272273
* to be processed
273-
* @param commentPrefix the prefix that identifies comments in the SQL script &mdash;
274-
* typically "--"
275-
* @param separator the statement separator in the SQL script &mdash; typically ";"
274+
* @param commentPrefix the prefix that identifies comments in the SQL script
275+
* (typically "--")
276+
* @param separator the statement separator in the SQL script (typically ";")
276277
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
277278
* @return a {@code String} containing the script lines
278279
* @throws IOException in case of I/O errors
279280
*/
280281
private static String readScript(EncodedResource resource, @Nullable String commentPrefix,
281-
@Nullable String separator, @Nullable String blockCommentEndDelimiter) throws IOException {
282+
@Nullable String separator, @Nullable String blockCommentEndDelimiter) throws IOException {
282283

283284
LineNumberReader lnr = new LineNumberReader(resource.getReader());
284285
try {
@@ -298,15 +299,15 @@ private static String readScript(EncodedResource resource, @Nullable String comm
298299
* a statement &mdash; will be included in the results.
299300
* @param lineNumberReader the {@code LineNumberReader} containing the script
300301
* to be processed
301-
* @param lineCommentPrefix the prefix that identifies comments in the SQL script &mdash;
302-
* typically "--"
303-
* @param separator the statement separator in the SQL script &mdash; typically ";"
302+
* @param lineCommentPrefix the prefix that identifies comments in the SQL script
303+
* (typically "--")
304+
* @param separator the statement separator in the SQL script (typically ";")
304305
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
305306
* @return a {@code String} containing the script lines
306307
* @throws IOException in case of I/O errors
307308
*/
308309
public static String readScript(LineNumberReader lineNumberReader, @Nullable String lineCommentPrefix,
309-
@Nullable String separator, @Nullable String blockCommentEndDelimiter) throws IOException {
310+
@Nullable String separator, @Nullable String blockCommentEndDelimiter) throws IOException {
310311

311312
String currentStatement = lineNumberReader.readLine();
312313
StringBuilder scriptBuilder = new StringBuilder();
@@ -434,16 +435,14 @@ public static void executeSqlScript(Connection connection, EncodedResource resou
434435
* @param ignoreFailedDrops whether or not to continue in the event of specifically
435436
* an error on a {@code DROP} statement
436437
* @param commentPrefix the prefix that identifies single-line comments in the
437-
* SQL script &mdash; typically "--"
438+
* SQL script (typically "--")
438439
* @param separator the script statement separator; defaults to
439440
* {@value #DEFAULT_STATEMENT_SEPARATOR} if not specified and falls back to
440441
* {@value #FALLBACK_STATEMENT_SEPARATOR} as a last resort; may be set to
441442
* {@value #EOF_STATEMENT_SEPARATOR} to signal that the script contains a
442443
* single statement without a separator
443-
* @param blockCommentStartDelimiter the <em>start</em> block comment delimiter; never
444-
* {@code null} or empty
445-
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter; never
446-
* {@code null} or empty
444+
* @param blockCommentStartDelimiter the <em>start</em> block comment delimiter
445+
* @param blockCommentEndDelimiter the <em>end</em> block comment delimiter
447446
* @throws ScriptException if an error occurred while executing the SQL script
448447
* @see #DEFAULT_STATEMENT_SEPARATOR
449448
* @see #FALLBACK_STATEMENT_SEPARATOR

spring-test/src/main/java/org/springframework/test/context/TestExecutionListener.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 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.
@@ -78,7 +78,6 @@ public interface TestExecutionListener {
7878
* @since 3.0
7979
*/
8080
default void beforeTestClass(TestContext testContext) throws Exception {
81-
/* no-op */
8281
}
8382

8483
/**
@@ -92,7 +91,6 @@ default void beforeTestClass(TestContext testContext) throws Exception {
9291
* @throws Exception allows any exception to propagate
9392
*/
9493
default void prepareTestInstance(TestContext testContext) throws Exception {
95-
/* no-op */
9694
}
9795

9896
/**
@@ -116,7 +114,6 @@ default void prepareTestInstance(TestContext testContext) throws Exception {
116114
* @see #afterTestExecution
117115
*/
118116
default void beforeTestMethod(TestContext testContext) throws Exception {
119-
/* no-op */
120117
}
121118

122119
/**
@@ -137,7 +134,6 @@ default void beforeTestMethod(TestContext testContext) throws Exception {
137134
* @see #afterTestExecution
138135
*/
139136
default void beforeTestExecution(TestContext testContext) throws Exception {
140-
/* no-op */
141137
}
142138

143139
/**
@@ -158,7 +154,6 @@ default void beforeTestExecution(TestContext testContext) throws Exception {
158154
* @see #beforeTestExecution
159155
*/
160156
default void afterTestExecution(TestContext testContext) throws Exception {
161-
/* no-op */
162157
}
163158

164159
/**
@@ -182,7 +177,6 @@ default void afterTestExecution(TestContext testContext) throws Exception {
182177
* @see #afterTestExecution
183178
*/
184179
default void afterTestMethod(TestContext testContext) throws Exception {
185-
/* no-op */
186180
}
187181

188182
/**
@@ -197,7 +191,6 @@ default void afterTestMethod(TestContext testContext) throws Exception {
197191
* @since 3.0
198192
*/
199193
default void afterTestClass(TestContext testContext) throws Exception {
200-
/* no-op */
201194
}
202195

203196
}

spring-test/src/main/java/org/springframework/test/context/support/AbstractGenericContextLoader.java

Lines changed: 2 additions & 2 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.
@@ -141,7 +141,7 @@ public final ConfigurableApplicationContext loadContext(MergedContextConfigurati
141141
* @since 4.0.4
142142
*/
143143
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
144-
/* no-op */
144+
// no-op
145145
}
146146

147147
/**

spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java

Lines changed: 2 additions & 2 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.
@@ -142,7 +142,7 @@ public final ConfigurableApplicationContext loadContext(MergedContextConfigurati
142142
* @since 4.0.4
143143
*/
144144
protected void validateMergedContextConfiguration(WebMergedContextConfiguration mergedConfig) {
145-
/* no-op */
145+
// no-op
146146
}
147147

148148
/**

spring-webmvc/src/test/java/org/springframework/web/servlet/resource/EncodedResourceResolverTests.java

Lines changed: 3 additions & 6 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.
@@ -78,7 +78,7 @@ static void createGzippedFile(String filePath) throws IOException {
7878

7979

8080
@Before
81-
public void setUp() {
81+
public void setup() {
8282
this.cache = new ConcurrentMapCache("resourceCache");
8383

8484
VersionResourceResolver versionResolver = new VersionResourceResolver();
@@ -127,9 +127,7 @@ public void resolveGzippedWithVersion() {
127127

128128
@Test
129129
public void resolveFromCacheWithEncodingVariants() {
130-
131130
// 1. Resolve, and cache .gz variant
132-
133131
String file = "js/foo.js";
134132
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/js/foo.js");
135133
request.addHeader("Accept-Encoding", "gzip");
@@ -140,7 +138,6 @@ public void resolveFromCacheWithEncodingVariants() {
140138
assertTrue(resolved instanceof HttpResource);
141139

142140
// 2. Resolve unencoded resource
143-
144141
request = new MockHttpServletRequest("GET", "/js/foo.js");
145142
resolved = this.resolver.resolveResource(request, file, this.locations);
146143

@@ -149,7 +146,7 @@ public void resolveFromCacheWithEncodingVariants() {
149146
assertFalse(resolved instanceof HttpResource);
150147
}
151148

152-
@Test // SPR-13149
149+
@Test // SPR-13149
153150
public void resolveWithNullRequest() {
154151
String file = "js/foo.js";
155152
Resource resolved = this.resolver.resolveResource(null, file, this.locations);

0 commit comments

Comments
 (0)