1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00
This commit is contained in:
Jesse Vincent 2010-12-24 18:55:05 +00:00
parent c49a856046
commit 9878b74379
10 changed files with 259 additions and 253 deletions

View File

@ -136,7 +136,7 @@ public class MessageView extends K9Activity implements OnClickListener
private Button mDownloadRemainder;
private static Drawable answeredIcon;
private static Drawable answeredIcon;
View next;

View File

@ -11,7 +11,7 @@ public interface MessageRetrievalListener
/**
* FIXME <strong>this method is almost never invoked by various Stores! Don't rely on it unless fixed!!</strong>
*
*
* @param total
*/
public void messagesFinished(int total);

View File

@ -1739,7 +1739,8 @@ public class MessagingController implements Runnable
public void messageStarted(String uid, int number, int ofTotal) {}
@Override
public void messagesFinished(int total) {
public void messagesFinished(int total)
{
// FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!!
}
@ -1753,10 +1754,10 @@ public class MessagingController implements Runnable
/**
* Actual storing of messages
*
*
* <br>
* FIXME: <strong>This method should really be moved in the above MessageRetrievalListener once {@link MessageRetrievalListener#messagesFinished(int)} is properly invoked by various stores</strong>
*
*
* @param messages Never <code>null</code>.
* @param localFolder
* @param account
@ -1772,7 +1773,7 @@ public class MessagingController implements Runnable
{
// Store the new message locally
localFolder.appendMessages(messages.toArray(new Message[messages.size()]));
for (final Message message : messages)
{
final Message localMessage = localFolder.getMessage(message.getUid());
@ -3717,7 +3718,8 @@ public class MessagingController implements Runnable
}
finally
{
if (lastFailure == null) {
if (lastFailure == null)
{
cancelNotification(K9.SEND_FAILED_NOTIFICATION - account.getAccountNumber());
}
closeFolder(localFolder);

View File

@ -539,7 +539,7 @@ public class Utility
to.delete();
}
to.getParentFile().mkdirs();
try
{
FileInputStream in = new FileInputStream(from);
@ -560,7 +560,7 @@ public class Utility
Log.w(K9.LOG_TAG, "cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath(), e);
return false;
}
}
/**

View File

@ -143,194 +143,194 @@ public class LocalStore extends Store implements Serializable
{
return DB_VERSION;
}
@Override
public void doDbUpgrade(final SQLiteDatabase db)
{
Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d",
db.getVersion(), DB_VERSION));
Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d",
db.getVersion(), DB_VERSION));
AttachmentProvider.clear(mApplication);
AttachmentProvider.clear(mApplication);
try
{
// schema version 29 was when we moved to incremental updates
// in the case of a new db or a < v29 db, we blow away and start from scratch
if (db.getVersion() < 29)
try
{
db.execSQL("DROP TABLE IF EXISTS folders");
db.execSQL("CREATE TABLE folders (id INTEGER PRIMARY KEY, name TEXT, "
+ "last_updated INTEGER, unread_count INTEGER, visible_limit INTEGER, status TEXT, push_state TEXT, last_pushed INTEGER, flagged_count INTEGER default 0)");
db.execSQL("CREATE INDEX IF NOT EXISTS folder_name ON folders (name)");
db.execSQL("DROP TABLE IF EXISTS messages");
db.execSQL("CREATE TABLE messages (id INTEGER PRIMARY KEY, deleted INTEGER default 0, folder_id INTEGER, uid TEXT, subject TEXT, "
+ "date INTEGER, flags TEXT, sender_list TEXT, to_list TEXT, cc_list TEXT, bcc_list TEXT, reply_to_list TEXT, "
+ "html_content TEXT, text_content TEXT, attachment_count INTEGER, internal_date INTEGER, message_id TEXT, preview TEXT)");
db.execSQL("DROP TABLE IF EXISTS headers");
db.execSQL("CREATE TABLE headers (id INTEGER PRIMARY KEY, message_id INTEGER, name TEXT, value TEXT)");
db.execSQL("CREATE INDEX IF NOT EXISTS header_folder ON headers (message_id)");
db.execSQL("CREATE INDEX IF NOT EXISTS msg_uid ON messages (uid, folder_id)");
db.execSQL("DROP INDEX IF EXISTS msg_folder_id");
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
db.execSQL("DROP TABLE IF EXISTS attachments");
db.execSQL("CREATE TABLE attachments (id INTEGER PRIMARY KEY, message_id INTEGER,"
+ "store_data TEXT, content_uri TEXT, size INTEGER, name TEXT,"
+ "mime_type TEXT, content_id TEXT, content_disposition TEXT)");
db.execSQL("DROP TABLE IF EXISTS pending_commands");
db.execSQL("CREATE TABLE pending_commands " +
"(id INTEGER PRIMARY KEY, command TEXT, arguments TEXT)");
db.execSQL("DROP TRIGGER IF EXISTS delete_folder");
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;");
db.execSQL("DROP TRIGGER IF EXISTS delete_message");
db.execSQL("CREATE TRIGGER delete_message BEFORE DELETE ON messages BEGIN DELETE FROM attachments WHERE old.id = message_id; "
+ "DELETE FROM headers where old.id = message_id; END;");
}
else
{
// in the case that we're starting out at 29 or newer, run all the needed updates
if (db.getVersion() < 30)
{
try
{
db.execSQL("ALTER TABLE messages ADD deleted INTEGER default 0");
}
catch (SQLiteException e)
{
if (! e.toString().startsWith("duplicate column name: deleted"))
{
throw e;
}
}
}
if (db.getVersion() < 31)
// schema version 29 was when we moved to incremental updates
// in the case of a new db or a < v29 db, we blow away and start from scratch
if (db.getVersion() < 29)
{
db.execSQL("DROP TABLE IF EXISTS folders");
db.execSQL("CREATE TABLE folders (id INTEGER PRIMARY KEY, name TEXT, "
+ "last_updated INTEGER, unread_count INTEGER, visible_limit INTEGER, status TEXT, push_state TEXT, last_pushed INTEGER, flagged_count INTEGER default 0)");
db.execSQL("CREATE INDEX IF NOT EXISTS folder_name ON folders (name)");
db.execSQL("DROP TABLE IF EXISTS messages");
db.execSQL("CREATE TABLE messages (id INTEGER PRIMARY KEY, deleted INTEGER default 0, folder_id INTEGER, uid TEXT, subject TEXT, "
+ "date INTEGER, flags TEXT, sender_list TEXT, to_list TEXT, cc_list TEXT, bcc_list TEXT, reply_to_list TEXT, "
+ "html_content TEXT, text_content TEXT, attachment_count INTEGER, internal_date INTEGER, message_id TEXT, preview TEXT)");
db.execSQL("DROP TABLE IF EXISTS headers");
db.execSQL("CREATE TABLE headers (id INTEGER PRIMARY KEY, message_id INTEGER, name TEXT, value TEXT)");
db.execSQL("CREATE INDEX IF NOT EXISTS header_folder ON headers (message_id)");
db.execSQL("CREATE INDEX IF NOT EXISTS msg_uid ON messages (uid, folder_id)");
db.execSQL("DROP INDEX IF EXISTS msg_folder_id");
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
}
if (db.getVersion() < 32)
{
db.execSQL("UPDATE messages SET deleted = 1 WHERE flags LIKE '%DELETED%'");
}
if (db.getVersion() < 33)
{
db.execSQL("DROP TABLE IF EXISTS attachments");
db.execSQL("CREATE TABLE attachments (id INTEGER PRIMARY KEY, message_id INTEGER,"
+ "store_data TEXT, content_uri TEXT, size INTEGER, name TEXT,"
+ "mime_type TEXT, content_id TEXT, content_disposition TEXT)");
try
db.execSQL("DROP TABLE IF EXISTS pending_commands");
db.execSQL("CREATE TABLE pending_commands " +
"(id INTEGER PRIMARY KEY, command TEXT, arguments TEXT)");
db.execSQL("DROP TRIGGER IF EXISTS delete_folder");
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;");
db.execSQL("DROP TRIGGER IF EXISTS delete_message");
db.execSQL("CREATE TRIGGER delete_message BEFORE DELETE ON messages BEGIN DELETE FROM attachments WHERE old.id = message_id; "
+ "DELETE FROM headers where old.id = message_id; END;");
}
else
{
// in the case that we're starting out at 29 or newer, run all the needed updates
if (db.getVersion() < 30)
{
db.execSQL("ALTER TABLE messages ADD preview TEXT");
}
catch (SQLiteException e)
{
if (! e.toString().startsWith("duplicate column name: preview"))
try
{
throw e;
db.execSQL("ALTER TABLE messages ADD deleted INTEGER default 0");
}
catch (SQLiteException e)
{
if (! e.toString().startsWith("duplicate column name: deleted"))
{
throw e;
}
}
}
if (db.getVersion() < 31)
{
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
}
if (db.getVersion() < 32)
{
db.execSQL("UPDATE messages SET deleted = 1 WHERE flags LIKE '%DELETED%'");
}
if (db.getVersion() < 33)
{
try
{
db.execSQL("ALTER TABLE messages ADD preview TEXT");
}
catch (SQLiteException e)
{
if (! e.toString().startsWith("duplicate column name: preview"))
{
throw e;
}
}
}
if (db.getVersion() < 34)
{
try
{
db.execSQL("ALTER TABLE folders ADD flagged_count INTEGER default 0");
}
catch (SQLiteException e)
{
if (! e.getMessage().startsWith("duplicate column name: flagged_count"))
{
throw e;
}
}
}
if (db.getVersion() < 35)
{
try
{
db.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to get rid of obsolete flag X_NO_SEEN_INFO", e);
}
}
if (db.getVersion() < 36)
{
try
{
db.execSQL("ALTER TABLE attachments ADD content_id TEXT");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to add content_id column to attachments");
}
}
if (db.getVersion() < 37)
{
try
{
db.execSQL("ALTER TABLE attachments ADD content_disposition TEXT");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to add content_disposition column to attachments");
}
}
}
if (db.getVersion() < 34)
{
try
// Database version 38 is solely to prune cached attachments now that we clear them better
if (db.getVersion() < 39)
{
db.execSQL("ALTER TABLE folders ADD flagged_count INTEGER default 0");
}
catch (SQLiteException e)
{
if (! e.getMessage().startsWith("duplicate column name: flagged_count"))
try
{
throw e;
db.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
}
}
}
if (db.getVersion() < 35)
{
try
{
db.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to get rid of obsolete flag X_NO_SEEN_INFO", e);
}
}
if (db.getVersion() < 36)
{
try
{
db.execSQL("ALTER TABLE attachments ADD content_id TEXT");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to add content_id column to attachments");
}
}
if (db.getVersion() < 37)
{
try
{
db.execSQL("ALTER TABLE attachments ADD content_disposition TEXT");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to add content_disposition column to attachments");
}
}
// Database version 38 is solely to prune cached attachments now that we clear them better
if (db.getVersion() < 39)
{
try
{
db.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
}
}
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0");
db.setVersion(0);
throw new Error("Database upgrade failed! Resetting your DB version to 0 to force a full schema recreation.");
}
db.setVersion(DB_VERSION);
if (db.getVersion() != DB_VERSION)
{
throw new Error("Database upgrade failed!");
}
// Unless we're blowing away the whole data store, there's no reason to prune attachments
// every time the user upgrades. it'll just cost them money and pain.
// try
//{
// pruneCachedAttachments(true);
//}
//catch (Exception me)
//{
// Log.e(K9.LOG_TAG, "Exception while force pruning attachments during DB update", me);
//}
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0");
db.setVersion(0);
throw new Error("Database upgrade failed! Resetting your DB version to 0 to force a full schema recreation.");
}
db.setVersion(DB_VERSION);
if (db.getVersion() != DB_VERSION)
{
throw new Error("Database upgrade failed!");
}
// Unless we're blowing away the whole data store, there's no reason to prune attachments
// every time the user upgrades. it'll just cost them money and pain.
// try
//{
// pruneCachedAttachments(true);
//}
//catch (Exception me)
//{
// Log.e(K9.LOG_TAG, "Exception while force pruning attachments during DB update", me);
//}
}
}
public long getSize() throws UnavailableStorageException
@ -2218,7 +2218,7 @@ public class LocalStore extends Store implements Serializable
/**
* Convenience transaction wrapper for storing a message and set it as fully downloaded. Implemented mainly to speed up DB transaction commit.
*
*
* @param message Message to store. Never <code>null</code>.
* @param runnable What to do before setting {@link Flag#X_DOWNLOADED_FULL}. Never <code>null</code>.
* @return The local version of the message. Never <code>null</code>.

View File

@ -57,7 +57,7 @@ public class LockableDatabase
*
*/
private static final long serialVersionUID = 8184421232587399369L;
public WrappedException(final Exception cause)
{
super(cause);
@ -437,7 +437,7 @@ public class LockableDatabase
*/
protected void openOrCreateDataspace(final Application application) throws UnavailableStorageException
{
lockWrite();
try
{
@ -473,7 +473,7 @@ public class LockableDatabase
protected File prepareStorage(final String providerId) throws UnavailableStorageException
{
final StorageManager storageManager = getStorageManager();
final File databaseFile;
final File databaseParentDir;
databaseFile = storageManager.getDatabase(uUid, providerId);
@ -492,7 +492,7 @@ public class LockableDatabase
}
Utility.touchFile(databaseParentDir, ".nomedia");
}
final File attachmentDir;
final File attachmentParentDir;
attachmentDir = storageManager
@ -512,7 +512,7 @@ public class LockableDatabase
/**
* Delete the backing database.
*
*
* @throws UnavailableStorageException
*/
public void delete() throws UnavailableStorageException
@ -541,7 +541,7 @@ public class LockableDatabase
}
catch (Exception e)
{
}
final StorageManager storageManager = getStorageManager();
try
@ -571,7 +571,7 @@ public class LockableDatabase
{
Log.i(K9.LOG_TAG, "LockableDatabase: delete(): Unable to delete backing DB file", e);
}
if (recreate)
{
openOrCreateDataspace(mApplication);

View File

@ -600,22 +600,22 @@ public class Pop3Store extends Store
// Ignore messages without a unique-id
if (uidParts.length >= 2)
{
Integer msgNum = Integer.valueOf(uidParts[0]);
String msgUid = uidParts[1];
if (unindexedUids.contains(msgUid))
{
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
{
Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
}
Integer msgNum = Integer.valueOf(uidParts[0]);
String msgUid = uidParts[1];
if (unindexedUids.contains(msgUid))
{
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
{
Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
}
Pop3Message message = mUidToMsgMap.get(msgUid);
if (message == null)
{
message = new Pop3Message(msgUid, this);
}
indexMessage(msgNum, message);
}
Pop3Message message = mUidToMsgMap.get(msgUid);
if (message == null)
{
message = new Pop3Message(msgUid, this);
}
indexMessage(msgNum, message);
}
}
}
}

View File

@ -391,7 +391,7 @@ public class WebDavStore extends Store
buffer.append("SELECT \"DAV:visiblecount\"\r\n");
buffer.append(" FROM \"\"\r\n");
buffer.append(" WHERE \"DAV:ishidden\"=False AND \"DAV:isfolder\"=False AND \"urn:schemas:httpmail:read\"=")
.append(messageState).append("\r\n");
.append(messageState).append("\r\n");
buffer.append(" GROUP BY \"DAV:ishidden\"\r\n");
buffer.append("</a:sql></a:searchrequest>\r\n");
return buffer.toString();
@ -540,11 +540,11 @@ public class WebDavStore extends Store
/**
* Determines which type of authentication Exchange is using and authenticates appropriately.
*
*
* @throws MessagingException
*/
public boolean authenticate()
throws MessagingException
throws MessagingException
{
try
{
@ -573,7 +573,7 @@ public class WebDavStore extends Store
else
{
throw new MessagingException("Error with code " + response.getStatusLine().getStatusCode() +
" during request processing: " + response.getStatusLine().toString());
" during request processing: " + response.getStatusLine().toString());
}
}
else if (info.requiredAuthType == AUTH_TYPE_FORM_BASED)
@ -604,11 +604,11 @@ public class WebDavStore extends Store
/**
* Makes the initial connection to Exchange for authentication. Determines the type of authentication necessary for
* the server.
*
*
* @throws MessagingException
*/
private ConnectionInfo doInitialConnection()
throws MessagingException
throws MessagingException
{
// For our initial connection we are sending an empty GET request to
// the configured URL, which should be in the following form:
@ -639,8 +639,8 @@ public class WebDavStore extends Store
info.requiredAuthType = AUTH_TYPE_BASIC;
}
else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success
(info.statusCode >= 300 && info.statusCode < 400) || // Redirect
(info.statusCode == 440)) // Unauthorized
(info.statusCode >= 300 && info.statusCode < 400) || // Redirect
(info.statusCode == 440)) // Unauthorized
{
// We will handle all 3 situations the same. First we take an educated
@ -671,7 +671,7 @@ public class WebDavStore extends Store
else
{
throw new IOException("Error with code " + info.statusCode + " during request processing: " +
response.getStatusLine().toString());
response.getStatusLine().toString());
}
}
catch (IOException ioe)
@ -685,11 +685,11 @@ public class WebDavStore extends Store
/**
* Performs form-based authentication.
*
*
* @throws MessagingException
*/
public void doFBA(ConnectionInfo info)
throws IOException, MessagingException
throws IOException, MessagingException
{
// Clear out cookies from any previous authentication.
mAuthCookies.clear();
@ -777,12 +777,12 @@ public class WebDavStore extends Store
// Reconstruct the login URL based on the original login URL and the form action.
URI finalUri = new URI(loginUri.getScheme(),
loginUri.getUserInfo(),
loginUri.getHost(),
loginUri.getPort(),
urlPath,
null,
null);
loginUri.getUserInfo(),
loginUri.getHost(),
loginUri.getPort(),
urlPath,
null,
null);
loginUrl = finalUri.toString();
}
@ -813,11 +813,11 @@ public class WebDavStore extends Store
/**
* Searches the specified stream for an HTML form and returns the form's action target.
*
*
* @throws IOException
*/
private String findFormAction(InputStream istream)
throws IOException
throws IOException
{
String formAction = null;
@ -901,8 +901,8 @@ public class WebDavStore extends Store
}
private InputStream sendRequest(String url, String method, StringEntity messageBody,
HashMap<String, String> headers, boolean tryAuth)
throws MessagingException
HashMap<String, String> headers, boolean tryAuth)
throws MessagingException
{
InputStream istream = null;
@ -971,7 +971,7 @@ public class WebDavStore extends Store
else if (statusCode < 200 || statusCode >= 300)
{
throw new IOException("Error with code " + statusCode + " during request processing: " +
response.getStatusLine().toString());
response.getStatusLine().toString());
}
if (entity != null)
@ -1004,20 +1004,20 @@ public class WebDavStore extends Store
* response.
*/
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers)
throws MessagingException
throws MessagingException
{
return processRequest(url, method, messageBody, headers, true);
}
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers,
boolean needsParsing)
throws MessagingException
boolean needsParsing)
throws MessagingException
{
DataSet dataset = new DataSet();
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
{
Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
+ messageBody + "'");
+ messageBody + "'");
}
if (url == null ||
@ -1061,7 +1061,7 @@ public class WebDavStore extends Store
catch (ParserConfigurationException pce)
{
Log.e(K9.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: "
+ processException(pce));
+ processException(pce));
throw new MessagingException("ParserConfigurationException in processRequest() ", pce);
}
@ -1237,7 +1237,7 @@ public class WebDavStore extends Store
}
private void moveOrCopyMessages(Message[] messages, String folderName, boolean isMove)
throws MessagingException
throws MessagingException
{
String[] uids = new String[messages.length];
@ -1373,7 +1373,7 @@ public class WebDavStore extends Store
@Override
public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener)
throws MessagingException
throws MessagingException
{
ArrayList<Message> messages = new ArrayList<Message>();
String[] uids;
@ -1485,7 +1485,7 @@ public class WebDavStore extends Store
@Override
public void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener)
throws MessagingException
throws MessagingException
{
if (messages == null ||
messages.length == 0)
@ -1522,7 +1522,7 @@ public class WebDavStore extends Store
* Fetches the full messages or up to lines lines and passes them to the message parser.
*/
private void fetchMessages(Message[] messages, MessageRetrievalListener listener, int lines)
throws MessagingException
throws MessagingException
{
WebDavHttpClient httpclient;
httpclient = getHttpClient();
@ -1555,7 +1555,7 @@ public class WebDavStore extends Store
{
wdMessage.setUrl(getMessageUrls(new String[] { wdMessage.getUid() }).get(wdMessage.getUid()));
Log.i(K9.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
+ wdMessage.getUrl() + "'");
+ wdMessage.getUrl() + "'");
if (wdMessage.getUrl().equals(""))
{
throw new MessagingException("Unable to get URL for message");
@ -1565,7 +1565,7 @@ public class WebDavStore extends Store
try
{
Log.i(K9.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
+ wdMessage.getUrl() + "'");
+ wdMessage.getUrl() + "'");
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
HttpResponse response;
HttpEntity entity;
@ -1585,7 +1585,7 @@ public class WebDavStore extends Store
statusCode > 300)
{
throw new IOException("Error during with code " + statusCode + " during fetch: "
+ response.getStatusLine().toString());
+ response.getStatusLine().toString());
}
if (entity != null)
@ -1632,8 +1632,8 @@ public class WebDavStore extends Store
catch (IOException ioe)
{
Log.e(K9.LOG_TAG, "Non-success response code loading message, response code was " + statusCode
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
+ processException(ioe));
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
+ processException(ioe));
throw new MessagingException("Failure code " + statusCode, ioe);
}
@ -1731,7 +1731,7 @@ public class WebDavStore extends Store
* Call it a happy balance
*/
private void fetchEnvelope(Message[] startMessages, MessageRetrievalListener listener)
throws MessagingException
throws MessagingException
{
HashMap<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
HashMap<String, String> headers = new HashMap<String, String>();
@ -1813,7 +1813,7 @@ public class WebDavStore extends Store
@Override
public void setFlags(Message[] messages, Flag[] flags, boolean value)
throws MessagingException
throws MessagingException
{
String[] uids = new String[messages.length];
@ -1918,7 +1918,7 @@ public class WebDavStore extends Store
open(OpenMode.READ_WRITE);
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new BufferedOutputStream(out, 1024));
new BufferedOutputStream(out, 1024));
message.writeTo(msgOut);
msgOut.flush();
@ -1952,8 +1952,8 @@ public class WebDavStore extends Store
statusCode > 300)
{
throw new IOException("Error with status code " + statusCode
+ " while sending/appending message. Response = "
+ response.getStatusLine().toString() + " for message " + messageURL);
+ " while sending/appending message. Response = "
+ response.getStatusLine().toString() + " for message " + messageURL);
}
WebDavMessage retMessage = new WebDavMessage(message.getUid(), this);
@ -1984,8 +1984,8 @@ public class WebDavStore extends Store
public String getUidFromMessageId(Message message) throws MessagingException
{
Log.e(K9.LOG_TAG,
"Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
+ " being uploaded to the Sent folder");
"Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
+ " being uploaded to the Sent folder");
return null;
}
@ -1993,7 +1993,7 @@ public class WebDavStore extends Store
public void setFlags(Flag[] flags, boolean value) throws MessagingException
{
Log.e(K9.LOG_TAG,
"Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash");
"Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash");
// Try to make this efficient by not retrieving all of the messages
}
}
@ -2043,12 +2043,12 @@ public class WebDavStore extends Store
catch (UnsupportedEncodingException uee)
{
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in setUrl: " + uee + "\nTrace: "
+ processException(uee));
+ processException(uee));
}
catch (IllegalArgumentException iae)
{
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
+ processException(iae));
+ processException(iae));
}
for (int i = 0; i < length - 1; i++)
@ -2154,7 +2154,7 @@ public class WebDavStore extends Store
@Override
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException
String qName, Attributes atts) throws SAXException
{
mOpenTags.push(localName);
}
@ -2190,7 +2190,7 @@ public class WebDavStore extends Store
* Holds the mappings from the name returned from Exchange to the MIME format header name
*/
private final HashMap<String, String> mHeaderMappings = new HashMap<String, String>()
{
{
{
put("mime-version", "MIME-Version");
put("content-type", "Content-Type");
@ -2518,12 +2518,12 @@ public class WebDavStore extends Store
catch (UnsupportedEncodingException uee)
{
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in HttpGeneric(String uri): " + uee
+ "\nTrace: " + processException(uee));
+ "\nTrace: " + processException(uee));
}
catch (IllegalArgumentException iae)
{
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
+ processException(iae));
+ processException(iae));
}
for (int i = 0; i < length - 1; i++)
@ -2540,7 +2540,7 @@ public class WebDavStore extends Store
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
{
Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length()
+ ", end = '" + end + "' length = " + end.length());
+ ", end = '" + end + "' length = " + end.length());
}
url = url + "/" + end;
@ -2567,12 +2567,12 @@ public class WebDavStore extends Store
{
/*
* Copyright (C) 2007 The Android Open Source Project
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
@ -2584,7 +2584,7 @@ public class WebDavStore extends Store
}
public static InputStream getUngzippedContent(HttpEntity entity)
throws IOException
throws IOException
{
InputStream responseStream = entity.getContent();
if (responseStream == null)
@ -2604,7 +2604,7 @@ public class WebDavStore extends Store
}
public HttpResponse executeOverride(HttpUriRequest request, HttpContext context)
throws IOException
throws IOException
{
modifyRequestToAcceptGzipResponse(request);
return super.execute(request, context);

View File

@ -57,8 +57,11 @@ public class Editor implements android.content.SharedPreferences.Editor
}
// TODO Android 2.3 provides a sexy new "apply" method we need to implement
public void apply() { commit(); }
// TODO Android 2.3 provides a sexy new "apply" method we need to implement
public void apply()
{
commit();
}

View File

@ -243,9 +243,10 @@ public class AttachmentProvider extends ContentProvider
String dbName = segments.get(0);
String id = segments.get(1);
// Versions of K-9 before 3.400 had a database name here, not an
// Versions of K-9 before 3.400 had a database name here, not an
// account UID, so implement a bit of backcompat
if (dbName.endsWith(".db")) {
if (dbName.endsWith(".db"))
{
dbName = dbName.substring(0, dbName.length()-3);
}