Skip to content

Commit e9a32c2

Browse files
committed
Fix CI
1 parent 9d6d278 commit e9a32c2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

qulice-checkstyle/src/main/java/com/qulice/checkstyle/CheckstyleValidator.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,20 @@ private Configuration configuration() {
134134
}
135135
final Properties props = new Properties();
136136
props.setProperty("cache.file", cache.getPath());
137-
final java.io.InputStream checksStream = this.getClass().getResourceAsStream("checks.xml");
138-
if (checksStream == null) {
139-
throw new IllegalStateException(
140-
"Checkstyle configuration file 'checks.xml' not found in classpath."
141-
);
142-
}
143-
final InputSource src = new InputSource(checksStream);
144137
final Configuration config;
145-
try {
138+
try (java.io.InputStream stream = this.getClass().getResourceAsStream("checks.xml")) {
139+
if (stream == null) {
140+
throw new IllegalStateException(
141+
"Checkstyle configuration file 'checks.xml' not found in classpath."
142+
);
143+
}
144+
final InputSource src = new InputSource(stream);
146145
config = ConfigurationLoader.loadConfiguration(
147146
src,
148147
new PropertiesExpander(props),
149148
ConfigurationLoader.IgnoredModulesOptions.OMIT
150149
);
151-
} catch (final CheckstyleException ex) {
150+
} catch (final CheckstyleException | java.io.IOException ex) {
152151
throw new IllegalStateException("Failed to load config", ex);
153152
}
154153
return config;

0 commit comments

Comments
 (0)