JDK 9 RFR of JDK-8149154: tools/pack200/Pack200Test.java failed with NullPointerException

Amy Lu amy.lu at oracle.com
Mon Feb 22 12:41:36 UTC 2016


Please help to review this minor fix to post-test clean-up where 
NullPointerException should be avoided.

bug: https://bugs.openjdk.java.net/browse/JDK-8149154
webrev: http://cr.openjdk.java.net/~amlu/8149154/webrev.00/

Thanks,
Amy

--- old/test/tools/pack200/Pack200Test.java	2016-02-20 19:12:36.000000000 +0800
+++ new/test/tools/pack200/Pack200Test.java	2016-02-20 19:12:35.000000000 +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");
--- old/test/tools/pack200/Utils.java	2016-02-20 19:12:38.000000000 +0800
+++ new/test/tools/pack200/Utils.java	2016-02-20 19:12:38.000000000 +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) {





More information about the core-libs-dev mailing list