ManyZipFiles.java revision 0
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 6423026
* @summary Check that it is possible to open more than 2,048 zip files on
* Windows.
*/
public class ManyZipFiles {
static final int numFiles = 3000;
// Linux does not yet allow opening this many files; Solaris
// 8 requires an explicit allocation of more file descriptors
// to succeed. Since this test is written to check for a
// Windows capability it is much simpler to only run it
// on that platform.
return;
}
// Create some zip data
zos.closeEntry();
try {
// Create a directory for zip files created below
+ " already exists but is not a directory");
return;
}
fail("Couldn't create directory "
return;
}
fail("Don't have write access for directory "
return;
}
// Create and then open a large number of zip files
for (int i = 0; i < numFiles; i++) {
f.deleteOnExit();
try {
} catch (Throwable t) {
throw t;
}
}
} finally {
// This finally block is due to bug 4171239. On windows, if the
// file is still open at the end of the VM, deleteOnExit won't
// take place. "new ZipFile(...)" opens the zip file, so we have
// to explicity close those opened above. This finally block can
// be removed when 4171239 is fixed.
for (int i = 0; i < numFiles; i++) {
try {
} catch (Throwable t) {
+ " caught " + t);
}
}
}
}
pass();
}
//--------------------- Infrastructure ---------------------------
else fail(x + " not equal to " + y);}
}