Skip to content
Permalink
Browse files
8241130: com.sun.jndi.ldap.EventSupport.removeDeadNotifier: java.lang…
….NullPointerException

Reviewed-by: dfuchs
  • Loading branch information
Chris Yin committed Mar 20, 2020
1 parent 3f69824 commit 7ded8b1e30ea341107c432d83d4a94d6268854a9
Showing with 13 additions and 3 deletions.
  1. +12 −2 src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java
  2. +1 −1 test/jdk/com/sun/jndi/ldap/RemoveNamingListenerTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@@ -250,7 +250,12 @@ synchronized void removeDeadNotifier(NotifierArgs info) {
if (debug) {
System.err.println("EventSupport.removeDeadNotifier: " + info.name);
}
notifiers.remove(info);
if (notifiers != null) {
// Only do this if cleanup() not been triggered, otherwise here
// will throw NullPointerException since notifiers will be set to
// null in cleanup()
notifiers.remove(info);
}
}

/**
@@ -329,6 +334,11 @@ synchronized void cleanup() {
*/
synchronized void queueEvent(EventObject event,
Vector<? extends NamingListener> vector) {
if (notifiers == null) {
// That means cleanup() already done, not queue event anymore,
// otherwise, new created EventQueue will not been cleanup.
return;
}
if (eventQueue == null)
eventQueue = new EventQueue();

@@ -39,7 +39,7 @@

/**
* @test
* @bug 8176192
* @bug 8176192 8241130
* @summary Incorrect usage of Iterator in Java 8 In com.sun.jndi.ldap.
* EventSupport.removeNamingListener
* @modules java.naming

0 comments on commit 7ded8b1

Please sign in to comment.