[8u] RFR 8062947: Fix exception message to correctly represent LDAP connection failure
Zhengyu Gu
zgu at redhat.com
Wed Sep 2 15:57:59 UTC 2020
Thanks, Paul
-Zhengyu
On 9/2/20 11:55 AM, Hohensee, Paul wrote:
> Lgtm.
>
> Thanks,
> Paul
>
> On 9/2/20, 8:49 AM, "jdk8u-dev on behalf of Zhengyu Gu" <jdk8u-dev-retn at openjdk.java.net on behalf of zgu at redhat.com> wrote:
>
> I would like to backport this patch to 8u for parity with Oracle 8u271.
>
> The original patch applies cleanly on top of JDK-8151678, both are the
> followups of JDK-8160768.
>
> However, included new test uses new language feature 'var' which does
> not exist in 8u, fixed as follow:
>
> diff -r 9c90228fb2d9 -r 96d71ec83814
> test/com/sun/jndi/ldap/NamingExceptionMessageTest.java
> --- a/test/com/sun/jndi/ldap/NamingExceptionMessageTest.java Thu May 07
> 19:18:22 2020 +0100
> +++ b/test/com/sun/jndi/ldap/NamingExceptionMessageTest.java Mon Jul 13
> 15:46:57 2020 -0400
> @@ -51,11 +51,11 @@
>
> @Test
> public void timeoutMessageTest() throws Exception {
> - try (var ldapServer = TestLdapServer.newInstance(false)) {
> + try (TestLdapServer ldapServer =
> TestLdapServer.newInstance(false)) {
> ldapServer.start();
> ldapServer.awaitStartup();
> - var env =
> ldapServer.getInitialLdapCtxEnvironment(TIMEOUT_VALUE);
> - var namingException =
> Assert.expectThrows(NamingException.class, () -> new
> InitialDirContext(env));
> + Hashtable<Object, Object> env =
> ldapServer.getInitialLdapCtxEnvironment(TIMEOUT_VALUE);
> + Exception namingException =
> Assert.expectThrows(NamingException.class, () -> new
> InitialDirContext(env));
> System.out.println("Got naming exception:" + namingException);
> Assert.assertEquals(namingException.getMessage(),
> EXPECTED_TIMEOUT_MESSAGE);
> }
> @@ -63,11 +63,11 @@
>
> @Test
> public void connectionClosureMessageTest() throws Exception {
> - try (var ldapServer = TestLdapServer.newInstance(true)) {
> + try (TestLdapServer ldapServer =
> TestLdapServer.newInstance(true)) {
> ldapServer.start();
> ldapServer.awaitStartup();
> - var env = ldapServer.getInitialLdapCtxEnvironment(0);
> - var namingException =
> Assert.expectThrows(NamingException.class, () -> new
> InitialDirContext(env));
> + Hashtable<Object, Object> env =
> ldapServer.getInitialLdapCtxEnvironment(0);
> + Exception namingException =
> Assert.expectThrows(NamingException.class, () -> new
> InitialDirContext(env));
> System.out.println("Got naming exception:" + namingException);
> Assert.assertEquals(namingException.getMessage(),
> EXPECTED_CLOSURE_MESSAGE);
> }
>
>
> The original bug: https://bugs.openjdk.java.net/browse/JDK-8062947
> The original patch: https://hg.openjdk.java.net/jdk/jdk/rev/868fe697bad4
>
>
> 8u webrev: http://cr.openjdk.java.net/~zgu/JDK-8062947-8u/webrev.00/
>
> Test:
> Included NamingExceptionMessageTest.java test on Linux x86_64
>
> Thanks,
>
> -Zhengyu
>
>
More information about the jdk8u-dev
mailing list