changeset 11641:5f39475e0165

8154304: NullpointerException at LdapReferralException.getReferralContext Reviewed-by: xuelei, vinnie
author coffeys
date Sat, 16 Apr 2016 13:50:15 +0100
parents 939fcf5887f6
children 74085e728d5e
files src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java	Fri Apr 15 14:47:15 2016 +0100
+++ b/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java	Sat Apr 16 13:50:15 2016 +0100
@@ -92,7 +92,12 @@
             try {
                 referral = refEx.getNextReferral();
                 if (referral == null) {
-                    throw (NamingException)(previousEx.fillInStackTrace());
+                    if (previousEx != null) {
+                        throw (NamingException)(previousEx.fillInStackTrace());
+                    } else {
+                        throw new NamingException(
+                            "Illegal encoding: referral is empty");
+                    }
                 }
 
             } catch (LdapReferralException e) {