Replaced if with switch. Fixed typo in error.

This commit is contained in:
Peter Serwylo 2015-11-30 18:02:38 +11:00
parent c5bf2a131b
commit ab33eccaa2
3 changed files with 21 additions and 22 deletions

View File

@ -122,7 +122,7 @@ public class RepoPersister {
try {
context.getContentResolver().applyBatch(TempApkProvider.getAuthority(), apkOperations);
} catch (RemoteException | OperationApplicationException e) {
throw new RepoUpdater.UpdateException(repo, "An internal error occured while updating the database", e);
throw new RepoUpdater.UpdateException(repo, "An internal error occurred while updating the database", e);
}
}
@ -132,7 +132,7 @@ public class RepoPersister {
try {
context.getContentResolver().applyBatch(TempAppProvider.getAuthority(), appOperations);
} catch (RemoteException | OperationApplicationException e) {
throw new RepoUpdater.UpdateException(repo, "An internal error occured while updating the database", e);
throw new RepoUpdater.UpdateException(repo, "An internal error occurred while updating the database", e);
}
}

View File

@ -89,15 +89,15 @@ public class TempApkProvider extends ApkProvider {
@Override
public Uri insert(Uri uri, ContentValues values) {
int code = matcher.match(uri);
if (code == CODE_INIT) {
initTable();
return null;
} else if (code == CODE_COMMIT) {
commitTable();
return null;
} else {
return super.insert(uri, values);
switch (matcher.match(uri)) {
case CODE_INIT:
initTable();
return null;
case CODE_COMMIT:
commitTable();
return null;
default:
return super.insert(uri, values);
}
}

View File

@ -77,17 +77,16 @@ public class TempAppProvider extends AppProvider {
@Override
public Uri insert(Uri uri, ContentValues values) {
int code = matcher.match(uri);
if (code == CODE_INIT) {
initTable();
return null;
} else if (code == CODE_COMMIT) {
updateAppDetails();
commitTable();
return null;
} else {
return super.insert(uri, values);
switch (matcher.match(uri)) {
case CODE_INIT:
initTable();
return null;
case CODE_COMMIT:
updateAppDetails();
commitTable();
return null;
default:
return super.insert(uri, values);
}
}