Fixes Issue 1090

Don't try to fetch content while reporting errors.

Generate unique URL for each upload.
This commit is contained in:
Daniel Applebaum 2010-03-18 02:50:05 +00:00
parent 24d96c36da
commit ec9f395498

View file

@ -978,9 +978,8 @@ public class WebDavStore extends Store
else if (statusCode < 200 || else if (statusCode < 200 ||
statusCode >= 300) statusCode >= 300)
{ {
throw new IOException("Error during request processing: "+ throw new IOException("Error with code " + statusCode + " during request processing: "+
response.getStatusLine().toString()+ "\n\n"+ response.getStatusLine().toString());
getHttpRequestResponse(messageEntity, entity));
} }
else else
{ {
@ -1622,9 +1621,8 @@ public class WebDavStore extends Store
if (statusCode < 200 || if (statusCode < 200 ||
statusCode > 300) statusCode > 300)
{ {
throw new IOException("Error during fetch: "+ throw new IOException("Error during with code " + statusCode + " during fetch: "
response.getStatusLine().toString()+ "\n\n"+ + response.getStatusLine().toString());
getHttpRequestResponse(null, entity));
} }
if (entity != null) if (entity != null)
@ -1991,9 +1989,9 @@ public class WebDavStore extends Store
{ {
messageURL += "/"; messageURL += "/";
} }
messageURL += URLEncoder.encode(subject + ".eml"); messageURL += URLEncoder.encode(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
Log.i(K9.LOG_TAG, "Uploading message to " + mFolderUrl); Log.i(K9.LOG_TAG, "Uploading message as " + messageURL);
httpmethod = new HttpGeneric(messageURL); httpmethod = new HttpGeneric(messageURL);
httpmethod.setMethod("PUT"); httpmethod.setMethod("PUT");
@ -2012,9 +2010,9 @@ public class WebDavStore extends Store
if (statusCode < 200 || if (statusCode < 200 ||
statusCode > 300) statusCode > 300)
{ {
throw new IOException("Sending Message: Error while trying to append message to " + messageURL + " " + throw new IOException("Error with status code " + statusCode
response.getStatusLine().toString()+ "\n\n"+ + " while sending/appending message. Response = "
WebDavStore.getHttpRequestResponse(bodyEntity, response.getEntity())); + response.getStatusLine().toString() + " for message " + messageURL);
} }
WebDavMessage retMessage = new WebDavMessage(message.getUid(), this); WebDavMessage retMessage = new WebDavMessage(message.getUid(), this);