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

View File

@ -877,7 +877,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
@Nullable @Nullable
private String getRepoAddress(Apk apk) { 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); Repo repo = RepoProvider.Helper.findById(this, apk.repo, projection);
if (repo == null || repo.address == null) { if (repo == null || repo.address == null) {
return null; return null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -639,7 +639,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
class PrepareInitialSwapRepo extends PrepareSwapRepo { class PrepareInitialSwapRepo extends PrepareSwapRepo {
public PrepareInitialSwapRepo() { 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="EmptyForIteratorPad" />
<module name="GenericWhitespace" /> <module name="GenericWhitespace" />
<module name="MethodParamPad" /> <module name="MethodParamPad" />
<!--<module name="NoWhitespaceAfter" />--> <module name="NoWhitespaceAfter" />
<!--<module name="NoWhitespaceBefore" />--> <module name="NoWhitespaceBefore" />
<!--<module name="OperatorWrap" />--> <!--<module name="OperatorWrap" />-->
<module name="ParenPad" /> <module name="ParenPad" />
<module name="TypecastParenPad" /> <module name="TypecastParenPad" />