File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
qulice-checkstyle/src/main/java/com/qulice/checkstyle Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -134,17 +134,20 @@ private Configuration configuration() {
134134 }
135135 final Properties props = new Properties ();
136136 props .setProperty ("cache.file" , cache .getPath ());
137- final InputSource src = new InputSource (
138- this .getClass ().getResourceAsStream ("checks.xml" )
139- );
140137 final Configuration config ;
141- 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 );
142145 config = ConfigurationLoader .loadConfiguration (
143146 src ,
144147 new PropertiesExpander (props ),
145148 ConfigurationLoader .IgnoredModulesOptions .OMIT
146149 );
147- } catch (final CheckstyleException ex ) {
150+ } catch (final CheckstyleException | java . io . IOException ex ) {
148151 throw new IllegalStateException ("Failed to load config" , ex );
149152 }
150153 return config ;
You can’t perform that action at this time.
0 commit comments