--- old/test/java/util/zip/ZipFile/FinalizeZipFile.java 2014-01-08 10:15:10.397945446 +0800 +++ new/test/java/util/zip/ZipFile/FinalizeZipFile.java 2014-01-08 10:15:10.221945437 +0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,13 @@ /* @test * @bug 7007609 7009618 * @summary Check that ZipFile objects are always collected + * @run main/othervm FinalizeZipFile */ import java.io.*; -import java.nio.*; import java.util.Random; import java.util.zip.*; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; public class FinalizeZipFile { @@ -43,6 +42,7 @@ super(f); System.out.printf("Using %s%n", f.getPath()); } + @Override protected void finalize() throws IOException { System.out.printf("Killing %s%n", getName()); super.finalize(); @@ -81,7 +81,7 @@ makeGarbage(); System.gc(); - finalizersDone.await(5, TimeUnit.SECONDS); + finalizersDone.await(); // Not all ZipFiles were collected? equal(finalizersDone.getCount(), 0L);