8149154: tools/pack200/Pack200Test.java failed with NullPointerException
Reviewed-by: ksrini
--- a/jdk/test/tools/pack200/Pack200Test.java Mon Feb 22 11:23:03 2016 +0100
+++ b/jdk/test/tools/pack200/Pack200Test.java Tue Feb 23 09:52:56 2016 +0800
@@ -81,7 +81,9 @@
System.out.println("Packing [" + in.toString() + "]");
// Call the packer
Utils.pack(jarFile, packFile);
+ System.out.println("Done Packing [" + in.toString() + "]");
jarFile.close();
+ System.out.println("Start leak check");
leakCheck();
System.out.println(" Unpacking using java unpacker");
--- a/jdk/test/tools/pack200/Utils.java Mon Feb 22 11:23:03 2016 +0100
+++ b/jdk/test/tools/pack200/Utils.java Tue Feb 23 09:52:56 2016 +0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, 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
@@ -324,6 +324,9 @@
private static void findFiles0(File startDir, List<File> list,
FileFilter filter) throws IOException {
File[] foundFiles = startDir.listFiles(filter);
+ if (foundFiles == null) {
+ return;
+ }
list.addAll(Arrays.asList(foundFiles));
File[] dirs = startDir.listFiles(DIR_FILTER);
for (File dir : dirs) {