File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
qulice-checkstyle/src/main/java/com/qulice/checkstyle Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments