Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed NullPointerException when attachment hasn't filename attribute #222

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

Cybso
Copy link

@Cybso Cybso commented Oct 12, 2023

I got a NullPointerException while reading a .eml file whose Mime-Part hasn't had any filename:

java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because "etext" is null
	at jakarta.mail.internet.MimeUtility.decodeText(MimeUtility.java:585) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.mbox.JavaMailParser.parse(JavaMailParser.java:109) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.mbox.JavaMailParser.parse(JavaMailParser.java:85) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.mbox.JavaMailParser.parse(JavaMailParser.java:85) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.mbox.JavaMailParser.parse(JavaMailParser.java:57) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.MessageParser.parseJavaMailFile(MessageParser.java:37) ~[msgviewer.jar:?]
	at net.sourceforge.MSGViewer.factory.MessageParser.parseMessage(MessageParser.java:25) ~[msgviewer.jar:?]

If the filename is missing the attached commit changes it to 'unknown'.

@lolo101 lolo101 merged commit 338eedc into lolo101:master Oct 18, 2023
2 checks passed
@lolo101
Copy link
Owner

lolo101 commented Oct 18, 2023

Thank you @Cybso for your contribution 😉

@lolo101
Copy link
Owner

lolo101 commented Oct 21, 2023

Hi, just for the records I added a test case to validate the bug and the fix and to prevent regressions
6cfdec4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants