Reduce else depth
diff --git a/src/main/java/org/apache/commons/mail/EmailUtils.java b/src/main/java/org/apache/commons/mail/EmailUtils.java
index e3de9f8..1bf9f0c 100644
--- a/src/main/java/org/apache/commons/mail/EmailUtils.java
+++ b/src/main/java/org/apache/commons/mail/EmailUtils.java
@@ -221,7 +221,7 @@
{
return "";
}
- else if (count < 0)
+ if (count < 0)
{
throw new IllegalArgumentException("Requested random string length " + count + " is less than 0.");
}
diff --git a/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java b/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
index 4f1fcdb..a53e051 100644
--- a/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
+++ b/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
@@ -92,29 +92,25 @@
final String resourceName = getResourceName(resourceLocation);
final InputStream is = DataSourceClassPathResolver.class.getResourceAsStream(resourceName);
- if (is != null)
- {
- try
- {
- final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType);
- // EMAIL-125: set the name of the DataSource to the normalized resource URL
- // similar to other DataSource implementations, e.g. FileDataSource, URLDataSource
- ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString());
- result = ds;
- }
- finally
- {
- is.close();
- }
- }
- else
- {
+ if (is == null) {
if (isLenient)
{
return null;
}
throw new IOException("The following class path resource was not found : " + resourceLocation);
}
+ try
+ {
+ final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType);
+ // EMAIL-125: set the name of the DataSource to the normalized resource URL
+ // similar to other DataSource implementations, e.g. FileDataSource, URLDataSource
+ ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString());
+ result = ds;
+ }
+ finally
+ {
+ is.close();
+ }
}