lolo101/MsgViewer

MSG2Eml crashes sometimes with certain mails

Closed this issue · 4 comments

Hey,

we recently got some emails in our hands where the conversion from msg 2 eml failed (seems Outlook changed something). in particular, it's the writing eml part that fails as reading it seems to be no problem via the GUI.

if you need I can share a file for debugging purposes only (file with customer data).

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 1
        at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
        at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
        at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
        at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
        at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4608)
        at java.base/java.lang.String.substring(String.java:2720)
        at net.sourceforge.MSGViewer.factory.mbox.MBoxWriterViaJavaMail.addHeaders(MBoxWriterViaJavaMail.java:162)
        at net.sourceforge.MSGViewer.factory.mbox.MBoxWriterViaJavaMail.write(MBoxWriterViaJavaMail.java:65)
        at net.sourceforge.MSGViewer.factory.MessageSaver.write(MessageSaver.java:63)
        at net.sourceforge.MSGViewer.factory.MessageSaver.saveEMLFile(MessageSaver.java:58)
        at net.sourceforge.MSGViewer.factory.MessageSaver.saveMessage(MessageSaver.java:37)
        at net.sourceforge.MSGViewer.CLIFileConverter.processFile(CLIFileConverter.java:101)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at net.sourceforge.MSGViewer.CLIFileConverter.work(CLIFileConverter.java:74)
        at net.sourceforge.MSGViewer.ModuleLauncher.invoke(ModuleLauncher.java:66)
        at net.sourceforge.MSGViewer.ModuleLauncher.main(ModuleLauncher.java:31)

image

Hi @datsteves!

It looks like the msg files contain headers that are not formatted as expected.
They do not follow the "key: value" format, more precisely they do not have a semicolon.
Or a multi-line header that does not start with a whitespace.

Yes i'd be interested in the message (just the headers if you prefer)
https://support.microsoft.com/en-us/office/view-internet-message-headers-in-outlook-cd039382-dc6e-4264-ac74-c048563d212c

hey @lolo101

we actually tried to do that with the header, but somehow that didn't really work.
did just send you an email though with a downloadlink to the email for testing.

Ok @datsteves, the issue is an empty line at the end of the headers.
Gonna fix this!

Hi @datsteves do not hesitate to reopen if the problem persists ;)