changeset 1757:3487086f145a

8134304: NPE in initialization of OptimisticTypesPersistence Reviewed-by: hannesw, jlaskey, mhaupt
author sdama
date Wed, 10 Aug 2016 09:21:58 -0700
parents ee77c6b3713a
children eb330974acdf
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Mon Aug 08 12:51:44 2016 +0200
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java	Wed Aug 10 09:21:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,8 @@
                 }
                 versionDir.mkdirs();
                 if (versionDir.isDirectory()) {
+                    //FIXME:Logger is disabled as Context.getContext() always returns null here because global scope object will not be created
+                    //by the time this method gets invoked
                     getLogger().info("Optimistic type persistence directory is " + versionDir);
                     return versionDir;
                 }
@@ -450,10 +452,12 @@
     private static DebugLogger getLogger() {
         try {
             return Context.getContext().getLogger(RecompilableScriptFunctionData.class);
+        } catch (final NullPointerException e) {
+            //Don't print stacktrace until we revisit this, NPE is a known issue here
         } catch (final Exception e) {
             e.printStackTrace();
-            return DebugLogger.DISABLED_LOGGER;
         }
+        return DebugLogger.DISABLED_LOGGER;
     }
 
     private static void scheduleCleanup() {