Skip to content

Commit

Permalink
NoSuchProviderException
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 2bf41f6 commit d389798
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/mail/BodyPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void setParent(Multipart parent) {
}

@Override
public StreamProvider getStreamProvider() throws MessagingException {
public StreamProvider getStreamProvider() throws NoSuchProviderException {
if (parent != null) {
return parent.getStreamProvider();
} else {
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/jakarta/mail/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public boolean match(SearchTerm term) throws MessagingException {
}

@Override
public StreamProvider getStreamProvider() throws MessagingException {
public StreamProvider getStreamProvider() throws NoSuchProviderException {
try {
try {
final Session s = this.session;
Expand All @@ -722,7 +722,7 @@ public StreamProvider getStreamProvider() throws MessagingException {
throw new IllegalStateException(sce);
}
} catch (RuntimeException re) {
throw new MessagingException("Unable to get " + StreamProvider.class.getName(), re);
throw new NoSuchProviderException("Unable to get " + StreamProvider.class.getName(), re);
}
}
}
6 changes: 3 additions & 3 deletions api/src/main/java/jakarta/mail/Multipart.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ public synchronized void setParent(Part parent) {
* {@link Session#getDefaultInstance(java.util.Properties, Authenticator)}.
*
* @return the StreamProvider implementation from the session.
* @throws MessagingException if errors.
* @throws NoSuchProviderException if errors.
*
* @since JavaMail 2.2
*/
protected StreamProvider getStreamProvider() throws MessagingException {
protected StreamProvider getStreamProvider() throws NoSuchProviderException {
Part parent = this.parent;
if (parent != null) {
return parent.getStreamProvider();
Expand All @@ -283,7 +283,7 @@ protected StreamProvider getStreamProvider() throws MessagingException {
throw new IllegalStateException(sce);
}
} catch (RuntimeException re) {
throw new MessagingException("Unable to get " + StreamProvider.class.getName(), re);
throw new NoSuchProviderException("Unable to get " + StreamProvider.class.getName(), re);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/jakarta/mail/Part.java
Original file line number Diff line number Diff line change
Expand Up @@ -461,19 +461,19 @@ Enumeration<Header> getNonMatchingHeaders(String[] header_names)
* It defaults to {@link Session#getDefaultInstance(java.util.Properties, Authenticator)}.
*
* @return the StreamProvider.
* @throws MessagingException if errors.
* @throws NoSuchProviderException if errors.
*
* @since JavaMail 2.2
*/
default StreamProvider getStreamProvider() throws MessagingException {
default StreamProvider getStreamProvider() throws NoSuchProviderException {
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);
throw new NoSuchProviderException("Unable to get " + StreamProvider.class.getName(), re);
}
}
}

0 comments on commit d389798

Please sign in to comment.