Skip to content
Permalink
Browse files
Collapse multiple identical catch clauses into one.
Remove unused import.
  • Loading branch information
garydgregory committed Jan 8, 2021
1 parent c066c8d commit 1644d9ae7b7eed9f68e6b896c008ec14979dcf01
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 31 deletions.
@@ -1969,11 +1969,7 @@ private InternetAddress createInternetAddress(final String email, final String n
// it will throw AddressException.
address.validate();
}
catch (final AddressException e)
{
throw new EmailException(e);
}
catch (final UnsupportedEncodingException e)
catch (final AddressException | UnsupportedEncodingException e)
{
throw new EmailException(e);
}
@@ -21,7 +21,6 @@
import java.io.PrintStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
* Exception thrown when a checked error occurs in commons-email.
@@ -482,11 +482,7 @@ public String embed(final DataSource dataSource, final String name, final String

return encodedCid;
}
catch (final MessagingException me)
{
throw new EmailException(me);
}
catch (final UnsupportedEncodingException uee)
catch (final MessagingException | UnsupportedEncodingException uee)
{
throw new EmailException(uee);
}
@@ -470,13 +470,9 @@ public MultiPartEmail attach(

getContainer().addBodyPart(bodyPart);
}
catch (final UnsupportedEncodingException uee)
catch (final UnsupportedEncodingException | MessagingException me)
{
// in case the file name could not be encoded
throw new EmailException(uee);
}
catch (final MessagingException me)
{
throw new EmailException(me);
}
setBoolHasAttachments(true);
@@ -40,11 +40,7 @@ public String getMsg()
{
return this.getPrimaryBodyPart().getContent().toString();
}
catch (final IOException ioE)
{
return null;
}
catch (final MessagingException msgE)
catch (final IOException | MessagingException msgE)
{
return null;
}
@@ -37,11 +37,7 @@ public String getMsg()
{
return this.getPrimaryBodyPart().getContent().toString();
}
catch (final IOException ioE)
{
return null;
}
catch (final MessagingException msgE)
catch (final IOException | MessagingException msgE)
{
return null;
}
@@ -42,11 +42,7 @@ public String getMsg()
{
return this.getPrimaryBodyPart().getContent().toString();
}
catch (final IOException ioE)
{
return null;
}
catch (final MessagingException msgE)
catch (final IOException | MessagingException msgE)
{
return null;
}

0 comments on commit 1644d9a

Please sign in to comment.