File tree 1 file changed +8
-5
lines changed
qulice-checkstyle/src/main/java/com/qulice/checkstyle
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -134,17 +134,20 @@ private Configuration configuration() {
134
134
}
135
135
final Properties props = new Properties ();
136
136
props .setProperty ("cache.file" , cache .getPath ());
137
- final InputSource src = new InputSource (
138
- this .getClass ().getResourceAsStream ("checks.xml" )
139
- );
140
137
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 );
142
145
config = ConfigurationLoader .loadConfiguration (
143
146
src ,
144
147
new PropertiesExpander (props ),
145
148
ConfigurationLoader .IgnoredModulesOptions .OMIT
146
149
);
147
- } catch (final CheckstyleException ex ) {
150
+ } catch (final CheckstyleException | java . io . IOException ex ) {
148
151
throw new IllegalStateException ("Failed to load config" , ex );
149
152
}
150
153
return config ;
You can’t perform that action at this time.
0 commit comments