Skip to content

Commit 60e3661

Browse files
committed
bz-68460 remove references to com.sun.net.ssl.internal.ssl.Provider
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.
1 parent 7299aec commit 60e3661

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

WHATSNEW

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Other changes:
1212

1313
Bugzilla Report 26453
1414

15+
* Removes direct references to com.sun.net.ssl.internal.ssl.Provider class
16+
from the mail task, since that internal JDK class is no longer available
17+
in recent versions of Java.
18+
Bugzilla Report 68460
19+
1520
Fixed bugs:
1621
-----------
1722

src/main/org/apache/tools/ant/taskdefs/email/JakartaMimeMailer.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import java.io.OutputStream;
2626
import java.io.PrintStream;
2727
import java.io.UnsupportedEncodingException;
28-
import java.security.Provider;
29-
import java.security.Security;
3028
import java.util.ArrayList;
3129
import java.util.List;
3230
import java.util.Locale;
@@ -148,15 +146,6 @@ public void send() {
148146
Session sesh;
149147
Authenticator auth = null;
150148
if (SSL) {
151-
try {
152-
final Provider p =
153-
Class.forName("com.sun.net.ssl.internal.ssl.Provider")
154-
.asSubclass(Provider.class).getDeclaredConstructor().newInstance();
155-
Security.addProvider(p);
156-
} catch (final Exception e) {
157-
throw new BuildException(
158-
"could not instantiate ssl security provider, check that you have JSSE in your classpath");
159-
}
160149
// SMTP provider
161150
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
162151
props.put("mail.smtp.socketFactory.fallback", "false");

src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import java.io.OutputStream;
2626
import java.io.PrintStream;
2727
import java.io.UnsupportedEncodingException;
28-
import java.security.Provider;
29-
import java.security.Security;
3028
import java.util.ArrayList;
3129
import java.util.List;
3230
import java.util.Locale;
@@ -150,15 +148,6 @@ public void send() {
150148
Session sesh;
151149
Authenticator auth = null;
152150
if (SSL) {
153-
try {
154-
final Provider p =
155-
Class.forName("com.sun.net.ssl.internal.ssl.Provider")
156-
.asSubclass(Provider.class).getDeclaredConstructor().newInstance();
157-
Security.addProvider(p);
158-
} catch (final Exception e) {
159-
throw new BuildException(
160-
"could not instantiate ssl security provider, check that you have JSSE in your classpath");
161-
}
162151
// SMTP provider
163152
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
164153
props.put("mail.smtp.socketFactory.fallback", "false");

0 commit comments

Comments
 (0)