Skip to content

Commit

Permalink
Comment reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <[email protected]>
  • Loading branch information
jbescos committed Mar 7, 2024
1 parent 13d9314 commit 2bf41f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion api/src/main/java/jakarta/mail/Multipart.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.IOException;
import java.io.OutputStream;
import java.util.ServiceConfigurationError;
import java.util.Vector;

/**
Expand Down Expand Up @@ -275,7 +276,15 @@ protected StreamProvider getStreamProvider() throws MessagingException {
if (parent != null) {
return parent.getStreamProvider();
} else {
return Session.getDefaultInstance(System.getProperties(), null).getStreamProvider();
try {
try {
return Session.getDefaultInstance(System.getProperties(), null).getStreamProvider();
} catch (ServiceConfigurationError sce) {
throw new IllegalStateException(sce);
}
} catch (RuntimeException re) {
throw new MessagingException("Unable to get " + StreamProvider.class.getName(), re);
}
}
}

Expand Down
11 changes: 10 additions & 1 deletion api/src/main/java/jakarta/mail/Part.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.ServiceConfigurationError;

/**
* The <code>Part</code> interface is the common base interface for
Expand Down Expand Up @@ -465,6 +466,14 @@ Enumeration<Header> getNonMatchingHeaders(String[] header_names)
* @since JavaMail 2.2
*/
default StreamProvider getStreamProvider() throws MessagingException {
return Session.getDefaultInstance(System.getProperties(), null).getStreamProvider();
try {
try {
return Session.getDefaultInstance(System.getProperties(), null).getStreamProvider();
} catch (ServiceConfigurationError sce) {
throw new IllegalStateException(sce);
}
} catch (RuntimeException re) {
throw new MessagingException("Unable to get " + StreamProvider.class.getName(), re);
}
}
}

0 comments on commit 2bf41f6

Please sign in to comment.