diff options
author | emcmanus <emcmanus@google.com> | 2019-03-28 14:57:05 -0700 |
---|---|---|
committer | Ron Shapiro <ronshapiro@google.com> | 2019-04-03 11:09:09 -0400 |
commit | f17d298a901683c0d1b0a05fa093a5936c7abcc5 (patch) | |
tree | 941f902d85204ff06efffa56df8dc1c92d8e1946 /value/src/test/java/com/google | |
parent | a81a9e253f28ee7480671dde3f2bf53589e19458 (diff) | |
download | auto-f17d298a901683c0d1b0a05fa093a5936c7abcc5.tar.gz |
Expand the exceptions covered by the workaround for a JDK8 jar bug.
Fixes https://github.com/google/auto/issues/715.
RELNOTES=Expand the exceptions covered by the workaround for a JDK8 jar bug.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=240859625
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r-- | value/src/test/java/com/google/auto/value/processor/TemplateVarsTest.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/TemplateVarsTest.java b/value/src/test/java/com/google/auto/value/processor/TemplateVarsTest.java index b30fee44..85f5accc 100644 --- a/value/src/test/java/com/google/auto/value/processor/TemplateVarsTest.java +++ b/value/src/test/java/com/google/auto/value/processor/TemplateVarsTest.java @@ -183,14 +183,20 @@ public class TemplateVarsTest { doTestBrokenInputStream(new NullPointerException("BrokenInputStream")); } + @Test + public void testBrokenInputStream_IllegalStateException() throws Exception { + doTestBrokenInputStream(new IllegalStateException("BrokenInputStream")); + } + // This is a complicated test that tries to simulates the failures that are worked around in // Template.parsedTemplateForResource. Those failures means that the InputStream returned by - // ClassLoader.getResourceAsStream sometimes throws IOException or NullPointerException while it - // is being read. To simulate that, we make a second ClassLoader with the same configuration as - // the one that runs this test, and we override getResourceAsStream so that it wraps the returned - // InputStream in a BrokenInputStream, which throws an exception after a certain number of - // characters. We check that that exception was indeed seen, and that we did indeed try to read - // the resource we're interested in, and that we succeeded in loading a Template nevertheless. + // ClassLoader.getResourceAsStream sometimes throws IOException or NullPointerException or + // IllegalStateException while it is being read. To simulate that, we make a second ClassLoader + // with the same configuration as the one that runs this test, and we override getResourceAsStream + // so that it wraps the returned InputStream in a BrokenInputStream, which throws an exception + // after a certain number of characters. We check that that exception was indeed seen, and that + // we did indeed try to read the resource we're interested in, and that we succeeded in loading a + // Template nevertheless. private void doTestBrokenInputStream(Exception exception) throws Exception { URLClassLoader shadowLoader = new ShadowLoader(getClass().getClassLoader(), exception); Runnable brokenInputStreamTest = |