Skip to content

Commit

Permalink
bz-68460 remove references to com.sun.net.ssl.internal.ssl.Provider
Browse files Browse the repository at this point in the history
The Java SSLContext API notes that TLS version will be available at runtime, so we don't have to lookup an internal JDK Provider class (which no longer exists in recent Java versions) and then register it as a Security Provider.
  • Loading branch information
jaikiran committed Jan 11, 2024
1 parent 7299aec commit 60e3661
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
5 changes: 5 additions & 0 deletions WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Other changes:

Bugzilla Report 26453

* Removes direct references to com.sun.net.ssl.internal.ssl.Provider class
from the mail task, since that internal JDK class is no longer available
in recent versions of Java.
Bugzilla Report 68460

Fixed bugs:
-----------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -148,15 +146,6 @@ public void send() {
Session sesh;
Authenticator auth = null;
if (SSL) {
try {
final Provider p =
Class.forName("com.sun.net.ssl.internal.ssl.Provider")
.asSubclass(Provider.class).getDeclaredConstructor().newInstance();
Security.addProvider(p);
} catch (final Exception e) {
throw new BuildException(
"could not instantiate ssl security provider, check that you have JSSE in your classpath");
}
// SMTP provider
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
props.put("mail.smtp.socketFactory.fallback", "false");
Expand Down
11 changes: 0 additions & 11 deletions src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -150,15 +148,6 @@ public void send() {
Session sesh;
Authenticator auth = null;
if (SSL) {
try {
final Provider p =
Class.forName("com.sun.net.ssl.internal.ssl.Provider")
.asSubclass(Provider.class).getDeclaredConstructor().newInstance();
Security.addProvider(p);
} catch (final Exception e) {
throw new BuildException(
"could not instantiate ssl security provider, check that you have JSSE in your classpath");
}
// SMTP provider
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
props.put("mail.smtp.socketFactory.fallback", "false");
Expand Down

0 comments on commit 60e3661

Please sign in to comment.