J2SE Version (please include all output from java -version flag):
java version "1.8.0_66-ea"
Java(TM) SE Runtime Environment (build 1.8.0_66-ea-b02)
Java HotSpot(TM) Client VM (build 25.66-b02, mixed mode, sharing)
Does this problem occur on J2SE 7ux, 8ux? Yes / No (be specific version#)
not work:
* 1.8.0_40
* 1.8.0_66-ea
work with:
* 1.7.0_71
Operating System Configuration Information (be specific):
Only tested on Windows 8, but this should be platform independent.
Bug Description:
If the flag LDAP connection flag javax.naming.Context.REFERRAL is set to
"follow" then the follow unexpected exception occur:
Exception in thread "main" java.lang.ClassCastException:
com.sun.jndi.ldap.LdapSearchEnumeration cannot be cast to
com.sun.jndi.ldap.LdapNamingEnumeration
at
com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumerati
on.java:78)
at
com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumerati
on.java:36)
at
com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreReferrals(AbstractLdapN
amingEnumeration.java:330)
at
com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNaming
Enumeration.java:227)
at
com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnum
eration.java:189)
at
com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreElements(AbstractLdapNa
mingEnumeration.java:117)
at TestLdap.query(TestLdap.java:43)
at TestLdap.main(TestLdap.java:19)
Steps to Reproduce (be specific):
Run the follow test program (attached). You need to change the account
setting. With Java 7 it print 2 numbers. With 8 it print only one number
and then it throw a ClassCastException. The first number is without
"follow". The second which is failing is with "follow".