Ensure constants always used for fields in RepoProvider.

This commit is contained in:
Peter Serwylo 2016-06-30 16:11:59 +10:00
parent a8d2b2aff3
commit 2ffd4ae428

View File

@ -141,8 +141,8 @@ public class RepoProvider extends FDroidProvider {
} else if (!fingerprint.equals(calcedFingerprint)) { } else if (!fingerprint.equals(calcedFingerprint)) {
// TODO the UI should represent this error! // TODO the UI should represent this error!
Log.e(TAG, "The stored and calculated fingerprints do not match!"); Log.e(TAG, "The stored and calculated fingerprints do not match!");
Log.e(TAG, "stored: " + fingerprint); Log.e(TAG, "Stored: " + fingerprint);
Log.e(TAG, "calced: " + calcedFingerprint); Log.e(TAG, "Calculated: " + calcedFingerprint);
} }
} }
} else if (!TextUtils.isEmpty(publicKey)) { } else if (!TextUtils.isEmpty(publicKey)) {
@ -327,14 +327,14 @@ public class RepoProvider extends FDroidProvider {
@Override @Override
public int delete(Uri uri, String where, String[] whereArgs) { public int delete(Uri uri, String where, String[] whereArgs) {
QuerySelection selection = new QuerySelection(where, whereArgs);
switch (MATCHER.match(uri)) { switch (MATCHER.match(uri)) {
case CODE_LIST: case CODE_LIST:
// Don't support deleting of multiple repos. // Don't support deleting of multiple repos.
return 0; return 0;
case CODE_SINGLE: case CODE_SINGLE:
where = (where == null ? "" : where + " AND ") + selection.add(Cols._ID + " = ?", new String[] {uri.getLastPathSegment()});
"_ID = " + uri.getLastPathSegment();
break; break;
default: default:
@ -342,7 +342,7 @@ public class RepoProvider extends FDroidProvider {
throw new UnsupportedOperationException("Invalid URI for repo content provider: " + uri); throw new UnsupportedOperationException("Invalid URI for repo content provider: " + uri);
} }
int rowsAffected = db().delete(getTableName(), where, whereArgs); int rowsAffected = db().delete(getTableName(), selection.getSelection(), selection.getArgs());
Utils.debugLog(TAG, "Deleted repos. Notifying provider change: '" + uri + "'."); Utils.debugLog(TAG, "Deleted repos. Notifying provider change: '" + uri + "'.");
getContext().getContentResolver().notifyChange(uri, null); getContext().getContentResolver().notifyChange(uri, null);
return rowsAffected; return rowsAffected;