Fix upgrade code.

In HC MR2 we introduced a column for a parentKey, but AFAICT, did not
use it. It was populated with a null value. The first upgrade code in
ICS assumed it was '0' which failed to upgrade it properly.

This prevents IMAP accounts from being broken when upgrading from GB ->
ICS.

Bug: 5252620
Change-Id: I000253b7c02ac1706710bdb21a820293f09cbea5
This commit is contained in:
Ben Komalo 2011-09-13 17:11:39 -07:00
parent 715ee4ec4c
commit 2c57e7036d
2 changed files with 12 additions and 8 deletions

View File

@ -325,7 +325,7 @@ public class ImapStore extends Store {
final ImapFolder folder = mailboxes.get(path);
final Mailbox mailbox = folder.mMailbox;
int delimiterIdx = mailbox.mServerId.lastIndexOf(mailbox.mDelimiter);
long parentKey = -1L;
long parentKey = Mailbox.NO_MAILBOX;
if (delimiterIdx != -1) {
String parentPath = path.substring(0, delimiterIdx);
final ImapFolder parentFolder = mailboxes.get(parentPath);
@ -585,12 +585,12 @@ public class ImapStore extends Store {
static class ImapMessage extends MimeMessage {
ImapMessage(String uid, ImapFolder folder) {
this.mUid = uid;
this.mFolder = folder;
mUid = uid;
mFolder = folder;
}
public void setSize(int size) {
this.mSize = size;
mSize = size;
}
@Override
@ -616,12 +616,12 @@ public class ImapStore extends Store {
public ImapException(String message, String alertText, Throwable throwable) {
super(message, throwable);
this.mAlertText = alertText;
mAlertText = alertText;
}
public ImapException(String message, String alertText) {
super(message);
this.mAlertText = alertText;
mAlertText = alertText;
}
public String getAlertText() {

View File

@ -2400,7 +2400,8 @@ outer:
// For posterity; this is the command we're executing:
//sqlite> UPDATE mailbox SET serverid=displayname WHERE mailbox._id in (
// ...> SELECT mailbox._id FROM mailbox,account,hostauth WHERE
// ...> mailbox.parentkey=0 AND mailbox.accountkey=account._id AND
// ...> (mailbox.parentkey isnull OR mailbox.parentkey=0) AND
// ...> mailbox.accountkey=account._id AND
// ...> account.hostauthkeyrecv=hostauth._id AND
// ...> (hostauth.protocol='imap' OR hostauth.protocol='pop3'));
try {
@ -2412,7 +2413,10 @@ outer:
+ Mailbox.TABLE_NAME + "." + MailboxColumns.ID + " FROM "
+ Mailbox.TABLE_NAME + "," + Account.TABLE_NAME + ","
+ HostAuth.TABLE_NAME + " WHERE "
+ Mailbox.TABLE_NAME + "." + MailboxColumns.PARENT_KEY + "=0 AND "
+ "("
+ Mailbox.TABLE_NAME + "." + MailboxColumns.PARENT_KEY + " isnull OR "
+ Mailbox.TABLE_NAME + "." + MailboxColumns.PARENT_KEY + "=0 "
+ ") AND "
+ Mailbox.TABLE_NAME + "." + MailboxColumns.ACCOUNT_KEY + "="
+ Account.TABLE_NAME + "." + AccountColumns.ID + " AND "
+ Account.TABLE_NAME + "." + AccountColumns.HOST_AUTH_KEY_RECV + "="