< prev index next >
test/jdk/java/util/zip/ConstructInflaterOutput.java
Print this page
8200116: ConstructInflaterOutput, ConstructDeflaterInput still spamming test logs
Summary: end() should always expect to be called eventually
Reviewed-by: sherman
@@ -31,21 +31,19 @@
import java.util.zip.*;
public class ConstructInflaterOutput {
static class MyInflater extends Inflater {
- private boolean ended = false;
- boolean getEnded() { return ended; }
+ volatile boolean ended = false;
public void end() {
- fail("MyInflater had end() called");
+ ended = true;
super.end();
}
}
- private static MyInflater inf = new MyInflater();
-
public static void realMain(String[] args) throws Throwable {
+ final MyInflater inf = new MyInflater();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InflaterOutputStream ios = null;
byte[] b = new byte[512];
// Check construction
@@ -102,17 +100,17 @@
} catch (IndexOutOfBoundsException ex) {
pass();
}
ios.flush();
- check(!inf.getEnded());
+ check(!inf.ended);
ios.flush();
- check(!inf.getEnded());
+ check(!inf.ended);
ios.finish();
- check(!inf.getEnded());
+ check(!inf.ended);
ios.close();
- check(!inf.getEnded());
+ check(!inf.ended);
try {
ios.finish();
fail();
} catch (IOException ex) {
pass();
@@ -131,10 +129,11 @@
try {
ios.flush();
} catch (IOException ex) {
pass();
}
+ java.lang.ref.Reference.reachabilityFence(inf);
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
< prev index next >