Skip to content

Commit 5bde25f

Browse files
committed
Solving SpotBugs warning about nullable / nonnullable method result
1 parent ba052e5 commit 5bde25f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/core-module/src/main/java/org/simplejavamail/api/email/AttachmentResource.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import static java.nio.charset.StandardCharsets.UTF_8;
1616
import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument;
17+
import static org.simplejavamail.internal.util.Preconditions.verifyNonnull;
1718

1819
/**
1920
* A named immutable email attachment information object. The name can be a simple name, a filename or a named embedded image (eg.
@@ -116,7 +117,7 @@ public String readAllData(@SuppressWarnings("SameParameterValue") @NotNull final
116117
@NotNull
117118
public InputStream getDataSourceInputStream() {
118119
try {
119-
return dataSource.getInputStream();
120+
return getDataSource().getInputStream();
120121
} catch (IOException e) {
121122
throw new AttachmentResourceException("Error getting input stream from attachment's data source", e);
122123
}
@@ -127,7 +128,7 @@ public InputStream getDataSourceInputStream() {
127128
*/
128129
@NotNull
129130
public DataSource getDataSource() {
130-
return dataSource;
131+
return verifyNonnull(dataSource);
131132
}
132133

133134
/**

0 commit comments

Comments
 (0)