8013196: TimeZone.getDefault() throws NPE due to sun.awt.AppContext.getAppContext()
Reviewed-by: mchung, okutsu
This commit is contained in:
parent
94bc7320f8
commit
ceb0317980
@ -814,16 +814,24 @@ public final class AppContext {
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
|
||||
public Object get(Object key) {
|
||||
return getAppContext().get(key);
|
||||
AppContext ac = getAppContext();
|
||||
return (ac == null) ? null : ac.get(key);
|
||||
}
|
||||
public void put(Object key, Object value) {
|
||||
getAppContext().put(key, value);
|
||||
AppContext ac = getAppContext();
|
||||
if (ac != null) {
|
||||
ac.put(key, value);
|
||||
}
|
||||
}
|
||||
public void remove(Object key) {
|
||||
getAppContext().remove(key);
|
||||
AppContext ac = getAppContext();
|
||||
if (ac != null) {
|
||||
ac.remove(key);
|
||||
}
|
||||
}
|
||||
public boolean isDisposed() {
|
||||
return getAppContext().isDisposed();
|
||||
AppContext ac = getAppContext();
|
||||
return (ac == null) ? true : ac.isDisposed();
|
||||
}
|
||||
public boolean isMainAppContext() {
|
||||
return (numAppContexts.get() == 1 && mainAppContext != null);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2013, 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
|
||||
@ -170,6 +170,9 @@ public class SharedSecrets {
|
||||
public static JavaAWTAccess getJavaAWTAccess() {
|
||||
// this may return null in which case calling code needs to
|
||||
// provision for.
|
||||
if (javaAWTAccess == null || javaAWTAccess.getContext() == null) {
|
||||
return null;
|
||||
}
|
||||
return javaAWTAccess;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user