Replaced if with switch. Fixed typo in error.

This commit is contained in:
Peter Serwylo committed 2015-11-30 18:16:11 +11:00
1 parent c5bf2a131b
commit ab33eccaa2
3 files changed
+21 -22

No files matched your search

@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}