This is an automated email from the ASF dual-hosted git repository. lkishalmi pushed a commit to branch release120 in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 4099e687c7688cf4308c25fa250f77004af7da49 Author: Jaroslav Tulach <[email protected]> AuthorDate: Thu Jun 4 18:15:58 2020 +0200 Allow usage of NbBundle in thread-less environments --- .../src/org/openide/util/TimedSoftReference.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/platform/openide.util/src/org/openide/util/TimedSoftReference.java b/platform/openide.util/src/org/openide/util/TimedSoftReference.java index 0e192f4..5539935 100644 --- a/platform/openide.util/src/org/openide/util/TimedSoftReference.java +++ b/platform/openide.util/src/org/openide/util/TimedSoftReference.java @@ -67,8 +67,14 @@ final class TimedSoftReference<T> extends SoftReference<T> implements Runnable { this.o = o; this.m = m; this.k = k; - task = RP.create(this); - task.schedule(TIMEOUT); + try { + this.task = RP.create(this); + this.task.schedule(TIMEOUT); + } catch (SecurityException ex) { + // behave as regular SoftReference + this.o = null; + this.task = null; + } } public void run() { @@ -102,7 +108,9 @@ final class TimedSoftReference<T> extends SoftReference<T> implements Runnable { // touch me //System.err.println("Touch " + k); if (touched == 0) { - task.schedule(TIMEOUT); + if (task != null) { + task.schedule(TIMEOUT); + } } touched = System.currentTimeMillis(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
