@@ -183,14 +183,20 @@ public void testBrokenInputStream_NullPointerException() throws Exception {
183
183
doTestBrokenInputStream (new NullPointerException ("BrokenInputStream" ));
184
184
}
185
185
186
+ @ Test
187
+ public void testBrokenInputStream_IllegalStateException () throws Exception {
188
+ doTestBrokenInputStream (new IllegalStateException ("BrokenInputStream" ));
189
+ }
190
+
186
191
// This is a complicated test that tries to simulates the failures that are worked around in
187
192
// Template.parsedTemplateForResource. Those failures means that the InputStream returned by
188
- // ClassLoader.getResourceAsStream sometimes throws IOException or NullPointerException while it
189
- // is being read. To simulate that, we make a second ClassLoader with the same configuration as
190
- // the one that runs this test, and we override getResourceAsStream so that it wraps the returned
191
- // InputStream in a BrokenInputStream, which throws an exception after a certain number of
192
- // characters. We check that that exception was indeed seen, and that we did indeed try to read
193
- // the resource we're interested in, and that we succeeded in loading a Template nevertheless.
193
+ // ClassLoader.getResourceAsStream sometimes throws IOException or NullPointerException or
194
+ // IllegalStateException while it is being read. To simulate that, we make a second ClassLoader
195
+ // with the same configuration as the one that runs this test, and we override getResourceAsStream
196
+ // so that it wraps the returned InputStream in a BrokenInputStream, which throws an exception
197
+ // after a certain number of characters. We check that that exception was indeed seen, and that
198
+ // we did indeed try to read the resource we're interested in, and that we succeeded in loading a
199
+ // Template nevertheless.
194
200
private void doTestBrokenInputStream (Exception exception ) throws Exception {
195
201
URLClassLoader shadowLoader = new ShadowLoader (getClass ().getClassLoader (), exception );
196
202
Runnable brokenInputStreamTest =
0 commit comments