1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Renamed StorageImportExportException to SettingsImportExportException

This commit is contained in:
cketti 2011-10-14 06:00:10 +02:00
parent c835bb757a
commit f5e684310e
5 changed files with 41 additions and 41 deletions

View File

@ -73,7 +73,7 @@ import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.store.StorageManager;
import com.fsck.k9.view.ColorChip;
import com.fsck.k9.preferences.SettingsExporter;
import com.fsck.k9.preferences.StorageImportExportException;
import com.fsck.k9.preferences.SettingsImportExportException;
import com.fsck.k9.preferences.SettingsImporter;
import com.fsck.k9.preferences.SettingsImporter.AccountDescription;
import com.fsck.k9.preferences.SettingsImporter.ImportContents;
@ -1322,7 +1322,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
try {
mFileName = SettingsExporter.exportToFile(mContext, mIncludeGlobals,
mAccountUuids);
} catch (StorageImportExportException e) {
} catch (SettingsImportExportException e) {
Log.w(K9.LOG_TAG, "Exception during export", e);
return false;
}
@ -1387,7 +1387,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
is.close();
} catch (IOException e) { /* Ignore */ }
}
} catch (StorageImportExportException e) {
} catch (SettingsImportExportException e) {
Log.w(K9.LOG_TAG, "Exception during import", e);
return false;
} catch (FileNotFoundException e) {
@ -1455,7 +1455,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
is.close();
} catch (IOException e) { /* Ignore */ }
}
} catch (StorageImportExportException e) {
} catch (SettingsImportExportException e) {
Log.w(K9.LOG_TAG, "Exception during export", e);
return false;
}

View File

@ -77,7 +77,7 @@ public class SettingsExporter {
public static String exportToFile(Context context, boolean includeGlobals,
Set<String> accountUuids)
throws StorageImportExportException {
throws SettingsImportExportException {
OutputStream os = null;
String filename = null;
@ -95,7 +95,7 @@ public class SettingsExporter {
// If all went well, we return the name of the file just written.
return filename;
} catch (Exception e) {
throw new StorageImportExportException(e);
throw new SettingsImportExportException(e);
} finally {
if (os != null) {
try {
@ -108,7 +108,7 @@ public class SettingsExporter {
}
public static void exportPreferences(Context context, OutputStream os, boolean includeGlobals,
Set<String> accountUuids) throws StorageImportExportException {
Set<String> accountUuids) throws SettingsImportExportException {
try {
XmlSerializer serializer = Xml.newSerializer();
@ -160,7 +160,7 @@ public class SettingsExporter {
serializer.flush();
} catch (Exception e) {
throw new StorageImportExportException(e.getLocalizedMessage(), e);
throw new SettingsImportExportException(e.getLocalizedMessage(), e);
}
}

View File

@ -0,0 +1,21 @@
package com.fsck.k9.preferences;
public class SettingsImportExportException extends Exception {
public SettingsImportExportException() {
super();
}
public SettingsImportExportException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public SettingsImportExportException(String detailMessage) {
super(detailMessage);
}
public SettingsImportExportException(Throwable throwable) {
super(throwable);
}
}

View File

@ -111,11 +111,11 @@ public class SettingsImporter {
* @return An {@link ImportContents} instance containing information about the contents of the
* settings file.
*
* @throws StorageImportExportException
* @throws SettingsImportExportException
* In case of an error.
*/
public static ImportContents getImportStreamContents(InputStream inputStream)
throws StorageImportExportException {
throws SettingsImportExportException {
try {
// Parse the import stream but don't save individual settings (overview=true)
@ -137,10 +137,10 @@ public class SettingsImporter {
return new ImportContents(globalSettings, accounts);
} catch (StorageImportExportException e) {
} catch (SettingsImportExportException e) {
throw e;
} catch (Exception e) {
throw new StorageImportExportException(e);
throw new SettingsImportExportException(e);
}
}
@ -165,12 +165,12 @@ public class SettingsImporter {
* @return An {@link ImportResults} instance containing information about errors and
* successfully imported accounts.
*
* @throws StorageImportExportException
* @throws SettingsImportExportException
* In case of an error.
*/
public static ImportResults importSettings(Context context, InputStream inputStream,
boolean globalSettings, List<String> accountUuids, boolean overwrite)
throws StorageImportExportException {
throws SettingsImportExportException {
try
{
@ -274,7 +274,7 @@ public class SettingsImporter {
}
if (!editor.commit()) {
throw new StorageImportExportException("Failed to set default account");
throw new SettingsImportExportException("Failed to set default account");
}
} else {
Log.w(K9.LOG_TAG, "Was asked to import at least one account but none found.");
@ -288,10 +288,10 @@ public class SettingsImporter {
return new ImportResults(globalSettingsImported, importedAccounts, errorneousAccounts);
} catch (StorageImportExportException e) {
} catch (SettingsImportExportException e) {
throw e;
} catch (Exception e) {
throw new StorageImportExportException(e);
throw new SettingsImportExportException(e);
}
}
@ -578,7 +578,7 @@ public class SettingsImporter {
private static Imported parseSettings(InputStream inputStream, boolean globalSettings,
List<String> accountUuids, boolean overview)
throws StorageImportExportException {
throws SettingsImportExportException {
if (!overview && accountUuids == null) {
throw new IllegalArgumentException("Argument 'accountUuids' must not be null.");
@ -607,12 +607,12 @@ public class SettingsImporter {
if (imported == null || (overview && imported.globalSettings == null &&
imported.accounts == null)) {
throw new StorageImportExportException("Invalid import data");
throw new SettingsImportExportException("Invalid import data");
}
return imported;
} catch (Exception e) {
throw new StorageImportExportException(e);
throw new SettingsImportExportException(e);
}
}

View File

@ -1,21 +0,0 @@
package com.fsck.k9.preferences;
public class StorageImportExportException extends Exception {
public StorageImportExportException() {
super();
}
public StorageImportExportException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public StorageImportExportException(String detailMessage) {
super(detailMessage);
}
public StorageImportExportException(Throwable throwable) {
super(throwable);
}
}