[davmail] 03/05: add patch to fix compatibility with javamail > 1.4.3
Alexandre Rossi
alexandre.rossi at gmail.com
Sun Nov 27 11:01:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
niol-guest pushed a commit to branch master
in repository davmail.
commit a7cb2f555572591d8bbe8f29ae33794b8983994a
Author: Alexandre Rossi <alexandre.rossi at gmail.com>
Date: Sun Nov 27 11:30:25 2016 +0100
add patch to fix compatibility with javamail > 1.4.3
---
...ge-of-the-MimeMessage-class-with-javamail.patch | 42 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 43 insertions(+)
diff --git a/debian/patches/0003-Fix-the-usage-of-the-MimeMessage-class-with-javamail.patch b/debian/patches/0003-Fix-the-usage-of-the-MimeMessage-class-with-javamail.patch
new file mode 100644
index 0000000..237fd33
--- /dev/null
+++ b/debian/patches/0003-Fix-the-usage-of-the-MimeMessage-class-with-javamail.patch
@@ -0,0 +1,42 @@
+Author: Antonio Ospite <ao2 at ao2.it>
+Last-Update: 2016-10-22
+Subject: Fix the usage of the MimeMessage() class with javamail > 1.4.3
+Forwarded: https://sourceforge.net/p/davmail/bugs/633/
+
+DavMail passes the mimeBody InputStream to the MimeMessage() constructor
+and then reuses the InputStream afterwards assuming it still gives
+access to the full original message in ExchangeSession.Message.
+
+However this assumption is wrong, because some javamail versions alter
+the input stream passed to the MimeMessage constructor, see:
+https://sourceforge.net/p/davmail/bugs/633/
+https://kenai.com/bugzilla/show_bug.cgi?id=8562
+
+Fix this by passing a copy of the InputStream to MimeMessage().
+
+This fixes the problem of a command like "FETCH 18 (RFC822)" returning
+only the body of the message with no headers, when using javamail 1.5.6.
+---
+ src/java/davmail/exchange/ExchangeSession.java | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java
+index 473d360..1ec84f5 100644
+--- a/src/java/davmail/exchange/ExchangeSession.java
++++ b/src/java/davmail/exchange/ExchangeSession.java
+@@ -1984,7 +1984,11 @@ public abstract class ExchangeSession {
+ } else {
+ // load and parse message
+ mimeBody = new SharedByteArrayInputStream(getContent(this));
+- mimeMessage = new MimeMessage(null, mimeBody);
++
++ // Pass a copy of the input stream to MimeMessage, see:
++ // https://sourceforge.net/p/davmail/bugs/633/
++ // https://kenai.com/bugzilla/show_bug.cgi?id=8562
++ mimeMessage = new MimeMessage(null, mimeBody.newStream(0, -1));
+ mimeBody.reset();
+ // workaround for Exchange 2003 ActiveSync bug
+ if (mimeMessage.getHeader("MAIL FROM") != null) {
+--
+2.10.2
+
diff --git a/debian/patches/series b/debian/patches/series
index 2fcca21..8448743 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
0001-no-windows-service.patch
0002-no-osx-tray.patch
+0003-Fix-the-usage-of-the-MimeMessage-class-with-javamail.patch
0004-Set-classpath-add-target-davmail-lib.patch
0006-Disable-the-check-for-a-new-release.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/davmail.git
More information about the pkg-java-commits
mailing list