checkstyle: Add NoWhitespace{Before,After}

This commit is contained in:
Daniel Martí 2015-10-08 19:49:43 +02:00
parent 793788eadf
commit 95b53706f9
12 changed files with 29 additions and 29 deletions

View File

@ -62,7 +62,7 @@ public class FDroidServiceInfo extends ServiceInfoImpl implements Parcelable {
);
int addressCount = in.readInt();
for (int i = 0; i < addressCount; i ++) {
for (int i = 0; i < addressCount; i++) {
try {
addAddress((Inet4Address) Inet4Address.getByAddress(readBytes(in)));
} catch (UnknownHostException e) {
@ -71,7 +71,7 @@ public class FDroidServiceInfo extends ServiceInfoImpl implements Parcelable {
}
addressCount = in.readInt();
for (int i = 0; i < addressCount; i ++) {
for (int i = 0; i < addressCount; i++) {
try {
addAddress((Inet6Address) Inet6Address.getByAddress(readBytes(in)));
} catch (UnknownHostException e) {
@ -97,13 +97,13 @@ public class FDroidServiceInfo extends ServiceInfoImpl implements Parcelable {
dest.writeInt(getTextBytes().length);
dest.writeByteArray(getTextBytes());
dest.writeInt(getInet4Addresses().length);
for (int i = 0; i < getInet4Addresses().length; i ++) {
for (int i = 0; i < getInet4Addresses().length; i++) {
Inet4Address address = getInet4Addresses()[i];
dest.writeInt(address.getAddress().length);
dest.writeByteArray(address.getAddress());
}
dest.writeInt(getInet6Addresses().length);
for (int i = 0; i < getInet6Addresses().length; i ++) {
for (int i = 0; i < getInet6Addresses().length; i++) {
Inet6Address address = getInet6Addresses()[i];
dest.writeInt(address.getAddress().length);
dest.writeByteArray(address.getAddress());

View File

@ -877,7 +877,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
@Nullable
private String getRepoAddress(Apk apk) {
final String[] projection = { RepoProvider.DataColumns.ADDRESS };
final String[] projection = {RepoProvider.DataColumns.ADDRESS};
Repo repo = RepoProvider.Helper.findById(this, apk.repo, projection);
if (repo == null || repo.address == null) {
return null;

View File

@ -582,7 +582,7 @@ public class UpdateService extends IntentService implements ProgressListener {
private List<String> getKnownAppIdsFromProvider(List<App> apps) {
final Uri uri = AppProvider.getContentUri(apps);
final String[] fields = { AppProvider.DataColumns.APP_ID };
final String[] fields = {AppProvider.DataColumns.APP_ID};
Cursor cursor = getContentResolver().query(uri, fields, null, null, null);
int knownIdCount = cursor != null ? cursor.getCount() : 0;

View File

@ -339,7 +339,7 @@ public class ApkProvider extends FDroidProvider {
private QuerySelection queryApp(String appId) {
final String selection = DataColumns.APK_ID + " = ? ";
final String[] args = { appId };
final String[] args = {appId};
return new QuerySelection(selection, args);
}
@ -356,7 +356,7 @@ public class ApkProvider extends FDroidProvider {
private QuerySelection queryRepo(long repoId) {
final String selection = DataColumns.REPO_ID + " = ? ";
final String[] args = { Long.toString(repoId) };
final String[] args = {Long.toString(repoId)};
return new QuerySelection(selection, args);
}

View File

@ -31,7 +31,7 @@ public class AppProvider extends FDroidProvider {
private Helper() {}
public static int count(Context context, Uri uri) {
final String[] projection = { AppProvider.DataColumns._COUNT };
final String[] projection = {AppProvider.DataColumns._COUNT};
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
int count = 0;
if (cursor != null) {
@ -91,7 +91,7 @@ public class AppProvider extends FDroidProvider {
public static List<String> categories(Context context) {
final ContentResolver resolver = context.getContentResolver();
final Uri uri = getContentUri();
final String[] projection = { DataColumns.CATEGORIES };
final String[] projection = {DataColumns.CATEGORIES};
final Cursor cursor = resolver.query(uri, projection, null, null, null);
final Set<String> categorySet = new HashSet<>();
if (cursor != null) {
@ -561,7 +561,7 @@ public class AppProvider extends FDroidProvider {
private AppQuerySelection queryRepo(long repoId) {
final String selection = " fdroid_apk.repo = ? ";
final String[] args = { String.valueOf(repoId) };
final String[] args = {String.valueOf(repoId)};
return new AppQuerySelection(selection, args);
}
@ -616,7 +616,7 @@ public class AppProvider extends FDroidProvider {
private AppQuerySelection querySingle(String id) {
final String selection = "fdroid_app.id = ?";
final String[] args = { id };
final String[] args = {id};
return new AppQuerySelection(selection, args);
}
@ -636,13 +636,13 @@ public class AppProvider extends FDroidProvider {
private AppQuerySelection queryNewlyAdded() {
final String selection = "fdroid_app.added > ?";
final String[] args = { Utils.formatDate(Preferences.get().calcMaxHistory(), "") };
final String[] args = {Utils.formatDate(Preferences.get().calcMaxHistory(), "")};
return new AppQuerySelection(selection, args);
}
private AppQuerySelection queryRecentlyUpdated() {
final String selection = "fdroid_app.added != fdroid_app.lastUpdated AND fdroid_app.lastUpdated > ?";
final String[] args = { Utils.formatDate(Preferences.get().calcMaxHistory(), "") };
final String[] args = {Utils.formatDate(Preferences.get().calcMaxHistory(), "")};
return new AppQuerySelection(selection, args);
}

View File

@ -112,7 +112,7 @@ public class DBHelper extends SQLiteOpenHelper {
private void populateRepoNames(SQLiteDatabase db, int oldVersion) {
if (oldVersion < 37) {
Utils.debugLog(TAG, "Populating repo names from the url");
final String[] columns = { "address", "_id" };
final String[] columns = {"address", "_id"};
Cursor cursor = db.query(TABLE_REPO, columns,
"name IS NULL OR name = ''", null, null, null, null);
if (cursor != null) {
@ -124,7 +124,7 @@ public class DBHelper extends SQLiteOpenHelper {
ContentValues values = new ContentValues(1);
String name = Repo.addressToName(address);
values.put("name", name);
final String[] args = { Long.toString(id) };
final String[] args = {Long.toString(id)};
Utils.debugLog(TAG, "Setting repo name to '" + name + "' for repo " + address);
db.update(TABLE_REPO, values, "_id = ?", args);
cursor.moveToNext();
@ -293,7 +293,7 @@ public class DBHelper extends SQLiteOpenHelper {
if (oldVersion < 20) {
List<Repo> oldrepos = new ArrayList<>();
Cursor cursor = db.query(TABLE_REPO,
new String[] { "address", "inuse", "pubkey" },
new String[] {"address", "inuse", "pubkey"},
null, null, null, null, null);
if (cursor != null) {
if (cursor.getCount() > 0) {
@ -368,7 +368,7 @@ public class DBHelper extends SQLiteOpenHelper {
db.execSQL("alter table " + TABLE_REPO + " add column fingerprint text");
List<Repo> oldrepos = new ArrayList<>();
Cursor cursor = db.query(TABLE_REPO,
new String[] { "address", "pubkey" },
new String[] {"address", "pubkey"},
null, null, null, null, null);
if (cursor != null) {
if (cursor.getCount() > 0) {
@ -386,7 +386,7 @@ public class DBHelper extends SQLiteOpenHelper {
for (final Repo repo : oldrepos) {
ContentValues values = new ContentValues();
values.put("fingerprint", Utils.calcFingerprint(repo.pubkey));
db.update(TABLE_REPO, values, "address = ?", new String[] { repo.address });
db.update(TABLE_REPO, values, "address = ?", new String[] {repo.address});
}
}
}

View File

@ -126,12 +126,12 @@ public class InstalledAppProvider extends FDroidProvider {
}
private QuerySelection queryApp(String appId) {
return new QuerySelection("appId = ?", new String[]{ appId });
return new QuerySelection("appId = ?", new String[]{appId});
}
private QuerySelection querySearch(String query) {
return new QuerySelection("applicationLabel LIKE ?",
new String[]{ "%" + query + "%" });
new String[]{"%" + query + "%"});
}
@Override

View File

@ -73,7 +73,7 @@ public class RepoProvider extends FDroidProvider {
String[] projection) {
ContentResolver resolver = context.getContentResolver();
Uri uri = RepoProvider.getContentUri();
final String[] args = { fieldValue };
final String[] args = {fieldValue};
Cursor cursor = resolver.query(
uri, projection, fieldName + " = ?", args, null);
return cursorToList(cursor);
@ -159,7 +159,7 @@ public class RepoProvider extends FDroidProvider {
}
final Uri uri = getContentUri(repo.getId());
final String[] args = { Long.toString(repo.getId()) };
final String[] args = {Long.toString(repo.getId())};
resolver.update(uri, values, DataColumns._ID + " = ?", args);
repo.setValues(values);
}
@ -195,7 +195,7 @@ public class RepoProvider extends FDroidProvider {
public static int countAppsForRepo(Context context, long repoId) {
ContentResolver resolver = context.getContentResolver();
final String[] projection = { ApkProvider.DataColumns._COUNT_DISTINCT_ID };
final String[] projection = {ApkProvider.DataColumns._COUNT_DISTINCT_ID};
Uri apkUri = ApkProvider.getRepoUri(repoId);
Cursor cursor = resolver.query(apkUri, projection, null, null, null);
int count = 0;

View File

@ -101,7 +101,7 @@ public class HttpDownloader extends Downloader {
if (connection != null)
return;
Preferences prefs = Preferences.get();
if (prefs.isProxyEnabled() && ! isSwapUrl()) {
if (prefs.isProxyEnabled() && !isSwapUrl()) {
SocketAddress sa = new InetSocketAddress(prefs.getProxyHost(), prefs.getProxyPort());
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
NetCipher.setProxy(proxy);

View File

@ -55,7 +55,7 @@ public class AppDiff {
String pkgName = mPkgInfo.packageName;
// Check if there is already a package on the device with this name
// but it has been renamed to something else.
final String[] oldName = mPm.canonicalToCurrentPackageNames(new String[] { pkgName });
final String[] oldName = mPm.canonicalToCurrentPackageNames(new String[] {pkgName});
if (oldName != null && oldName.length > 0 && oldName[0] != null) {
pkgName = oldName[0];
mPkgInfo.packageName = pkgName;

View File

@ -639,7 +639,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
class PrepareInitialSwapRepo extends PrepareSwapRepo {
public PrepareInitialSwapRepo() {
super(new HashSet<>(Arrays.asList(new String[] { "org.fdroid.fdroid" })));
super(new HashSet<>(Arrays.asList(new String[] {"org.fdroid.fdroid"})));
}
}

View File

@ -37,8 +37,8 @@
<module name="EmptyForIteratorPad" />
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<!--<module name="NoWhitespaceAfter" />-->
<!--<module name="NoWhitespaceBefore" />-->
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore" />
<!--<module name="OperatorWrap" />-->
<module name="ParenPad" />
<module name="TypecastParenPad" />