8134304: NPE in initialization of OptimisticTypesPersistence
Reviewed-by: hannesw, jlaskey, mhaupt
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java Wed Jul 05 22:04:04 2017 +0200
+++ b/nashorn/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() {