From be1be56e3aee3375b01722c4bc4f7c8711dfac2a Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 28 Jul 2011 15:08:00 -0400 Subject: [PATCH] Fixed bug where uid in response was truncated The SAX parser returns chunks of text to the WebDavHandler. Other tags were correctly appending values while the special cased tag was simply assigned the value it was given, which would result in the last chunk assigned to it and not the whole string of text. --- src/com/fsck/k9/mail/store/WebDavStore.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index a0ecb5085..67c909e8d 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -2060,12 +2060,12 @@ public class WebDavStore extends Store { public class DataSet { private HashMap> mData = new HashMap>(); // private HashMap mLostData = new HashMap(); - private String mUid = ""; + private StringBuilder mUid = new StringBuilder(); private HashMap mTempData = new HashMap(); public void addValue(String value, String tagName) { if (tagName.equals("uid")) { - mUid = value; + mUid.append(value); } if (mTempData.containsKey(tagName)) { @@ -2076,9 +2076,10 @@ public class WebDavStore extends Store { } public void finish() { - if (mUid != null && + String uid = mUid.toString(); + if (!uid.equals("") && mTempData != null) { - mData.put(mUid, mTempData); + mData.put(uid, mTempData); } else if (mTempData != null) { /* * Lost Data are for requests that don't include a message UID. These requests should only have a depth @@ -2086,7 +2087,7 @@ public class WebDavStore extends Store { */ } - mUid = ""; + mUid = new StringBuilder(); mTempData = new HashMap(); }