Browse Source

Use try-with-resource in ScriptUtils

Closes gh-24385
pull/24069/head
Hyunjin Choi 6 years ago committed by GitHub
parent
commit
b4cf88499c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/init/ScriptUtils.java

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

@ -325,13 +325,9 @@ public abstract class ScriptUtils { @@ -325,13 +325,9 @@ public abstract class ScriptUtils {
private static String readScript(EncodedResource resource, @Nullable String[] commentPrefixes,
@Nullable String separator, @Nullable String blockCommentEndDelimiter) throws IOException {
LineNumberReader lnr = new LineNumberReader(resource.getReader());
try {
try (LineNumberReader lnr = new LineNumberReader(resource.getReader())) {
return readScript(lnr, commentPrefixes, separator, blockCommentEndDelimiter);
}
finally {
lnr.close();
}
}
/**

Loading…
Cancel
Save