src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java
Print this page
*** 80,93 ****
/**
* Returns a new code store instance.
*
* @param context the current context
! * @return The instance
! * @throws IOException If an error occurs
*/
! public static CodeStore newCodeStore(final Context context) throws IOException {
final Class<CodeStore> baseClass = CodeStore.class;
try {
// security check first
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
--- 80,92 ----
/**
* Returns a new code store instance.
*
* @param context the current context
! * @return The instance, or null if code store could not be created
*/
! public static CodeStore newCodeStore(final Context context) {
final Class<CodeStore> baseClass = CodeStore.class;
try {
// security check first
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
*** 101,113 ****
--- 100,117 ----
return store;
}
} catch (final AccessControlException e) {
context.getLogger(CodeStore.class).warning("failed to load code store provider ", e);
}
+ try {
final CodeStore store = new DirectoryCodeStore(context);
store.initLogger(context);
return store;
+ } catch (final IOException e) {
+ context.getLogger(CodeStore.class).warning("failed to create cache dir", e);
+ return null;
+ }
}
/**
* Store a compiled script in the cache.