Navigation Menu

Skip to content

Commit

Permalink
8262409: sun/security/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExcep…
Browse files Browse the repository at this point in the history
…tions. SSL test failures caused by java failed with "Server reported the wrong exception"

Reviewed-by: rhalade, xuelei
  • Loading branch information
Fernando Guallini authored and rhalade committed Jun 3, 2021
1 parent 5982cfc commit 3aa7062
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -690,7 +690,6 @@ javax/security/auth/kerberos/KerberosTixDateTest.java 8039280 generic-
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
sun/security/ssl/SSLSocketImpl/SSLSocketImplThrowsWrongExceptions.java 8262409 linux-all,macosx-x64

############################################################################

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
Expand Down Expand Up @@ -35,8 +35,8 @@
* @author Brad Wetmore
*/

import java.io.*;
import java.net.*;
import java.net.SocketException;
import java.util.concurrent.CountDownLatch;
import javax.net.ssl.*;

public class SSLSocketImplThrowsWrongExceptions {
Expand Down Expand Up @@ -64,7 +64,7 @@ public class SSLSocketImplThrowsWrongExceptions {
/*
* Is the server ready to serve?
*/
volatile static boolean serverReady = false;
private CountDownLatch serverReadyLatch = new CountDownLatch(1);

/*
* Turn on SSL debugging?
Expand All @@ -87,20 +87,20 @@ void doServerSide() throws Exception {
/*
* Signal Client, we're ready for his connect.
*/
serverReady = true;
serverReadyLatch.countDown();

try {
System.out.println("Server socket accepting...");
SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
System.out.println("Server starting handshake");
sslSocket.startHandshake();
throw new Exception("Handshake was successful");
} catch (SSLException e) {
} catch (SSLException | SocketException se){
/*
* Caught the right Exeption. Swallow it.
* Caught the right Exception. Swallow it.
*/
System.out.println("Server reported the right exception");
System.out.println(e.toString());
System.out.println(se);
} catch (Exception e) {
/*
* Caught the wrong exception. Rethrow it.
Expand All @@ -121,9 +121,7 @@ void doClientSide() throws Exception {
/*
* Wait for server to get started.
*/
while (!serverReady) {
Thread.sleep(50);
}
serverReadyLatch.await();

SSLSocketFactory sslsf =
(SSLSocketFactory) SSLSocketFactory.getDefault();
Expand Down Expand Up @@ -271,7 +269,7 @@ public void run() {
* Release the client, if not active already...
*/
System.err.println("Server died...");
serverReady = true;
serverReadyLatch.countDown();
serverException = e;
}
}
Expand All @@ -283,7 +281,7 @@ public void run() {
} catch (Exception e) {
serverException = e;
} finally {
serverReady = true;
serverReadyLatch.countDown();
}
}
}
Expand Down

3 comments on commit 3aa7062

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 3aa7062 Jun 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealCLanger the backport was successfully created on the branch RealCLanger-backport-3aa7062c in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 3aa7062c from the openjdk/jdk repository.

The commit being backported was authored by Fernando Guallini on 3 Jun 2021 and was reviewed by Rajan Halade and Xue-Lei Andrew Fan.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-3aa7062c:RealCLanger-backport-3aa7062c
$ git checkout RealCLanger-backport-3aa7062c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-3aa7062c

Please sign in to comment.