< prev index next >

test/jdk/java/util/zip/ConstructDeflaterInput.java

Print this page
8200116: ConstructInflaterOutput, ConstructDeflaterInput still spamming test logs
Summary: end() should always expect to be called eventually
Reviewed-by: sherman

*** 31,50 **** import java.util.zip.*; public class ConstructDeflaterInput { static class MyDeflater extends Deflater { ! private boolean ended = false; ! boolean getEnded() { return ended; } public void end() { ! fail("MyDeflater had end() called"); super.end(); } } - private static MyDeflater def = new MyDeflater(); public static void realMain(String[] args) throws Throwable { ByteArrayInputStream bais = new ByteArrayInputStream( "hello, world".getBytes()); DeflaterInputStream dis = null; byte[] b = new byte[512]; --- 31,49 ---- import java.util.zip.*; public class ConstructDeflaterInput { static class MyDeflater extends Deflater { ! volatile boolean ended = false; public void end() { ! ended = true; super.end(); } } public static void realMain(String[] args) throws Throwable { + final MyDeflater def = new MyDeflater(); ByteArrayInputStream bais = new ByteArrayInputStream( "hello, world".getBytes()); DeflaterInputStream dis = null; byte[] b = new byte[512];
*** 120,141 **** // Check unsupported operations // check(!dis.markSupported()); check(dis.available() == 1); ! check(!def.getEnded()); try { dis.reset(); fail(); } catch (IOException ex) { pass(); } // Check close // dis.close(); ! check(!def.getEnded()); try { dis.available(); fail(); } catch (IOException ex) { --- 119,140 ---- // Check unsupported operations // check(!dis.markSupported()); check(dis.available() == 1); ! check(!def.ended); try { dis.reset(); fail(); } catch (IOException ex) { pass(); } // Check close // dis.close(); ! check(!def.ended); try { dis.available(); fail(); } catch (IOException ex) {
*** 153,163 **** dis.skip(1); fail(); } catch (IOException ex) { pass(); } ! } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;} --- 152,162 ---- dis.skip(1); fail(); } catch (IOException ex) { pass(); } ! java.lang.ref.Reference.reachabilityFence(def); } //--------------------- Infrastructure --------------------------- static volatile int passed = 0, failed = 0; static void pass() {passed++;}
< prev index next >