|
2 | 2 |
|
3 | 3 | import org.simplejavamail.outlookmessageparser.model.OutlookMessage;
|
4 | 4 |
|
| 5 | +import javax.annotation.Nonnull; |
5 | 6 | import java.io.File;
|
6 | 7 | import java.io.IOException;
|
7 | 8 | import java.io.InputStream;
|
8 | 9 |
|
| 10 | +import static org.simplejavamail.internal.util.Preconditions.checkNonEmptyArgument; |
| 11 | + |
9 | 12 | /**
|
10 | 13 | * Helper class that parses {@link OutlookMessage} instances from the {@link org.simplejavamail.outlookmessageparser.OutlookMessageParser} library.
|
11 | 14 | */
|
12 | 15 | public final class OutlookMessageParser {
|
13 | 16 |
|
14 |
| - public static OutlookMessage parseOutlookMsg(final File msgFile) { |
| 17 | + private OutlookMessageParser() { |
| 18 | + // util / helper class |
| 19 | + } |
| 20 | + |
| 21 | + @Nonnull |
| 22 | + public static OutlookMessage parseOutlookMsg(@Nonnull final File msgFile) { |
| 23 | + checkNonEmptyArgument(msgFile, "msgFile"); |
15 | 24 | try {
|
16 | 25 | return new org.simplejavamail.outlookmessageparser.OutlookMessageParser().parseMsg(msgFile);
|
17 | 26 | } catch (final IOException e) {
|
18 | 27 | throw new OutlookMessageException(OutlookMessageException.ERROR_PARSING_OUTLOOK_MSG, e);
|
19 | 28 | }
|
20 | 29 | }
|
21 | 30 |
|
22 |
| - public static OutlookMessage parseOutlookMsg(final InputStream msgInputStream) { |
| 31 | + @Nonnull |
| 32 | + public static OutlookMessage parseOutlookMsg(@Nonnull final InputStream msgInputStream) { |
| 33 | + checkNonEmptyArgument(msgInputStream, "msgInputStream"); |
23 | 34 | try {
|
24 | 35 | return new org.simplejavamail.outlookmessageparser.OutlookMessageParser().parseMsg(msgInputStream);
|
25 | 36 | } catch (final IOException e) {
|
26 | 37 | throw new OutlookMessageException(OutlookMessageException.ERROR_PARSING_OUTLOOK_MSG, e);
|
27 | 38 | }
|
28 | 39 | }
|
29 | 40 |
|
30 |
| - public static OutlookMessage parseOutlookMsg(final String msgData) { |
| 41 | + @Nonnull |
| 42 | + public static OutlookMessage parseOutlookMsg(@Nonnull final String msgData) { |
| 43 | + checkNonEmptyArgument(msgData, "msgData"); |
31 | 44 | try {
|
32 | 45 | return new org.simplejavamail.outlookmessageparser.OutlookMessageParser().parseMsg(msgData);
|
33 | 46 | } catch (final IOException e) {
|
|
0 commit comments