checkstyle: Add curly checks

This commit is contained in:
Daniel Martí 2015-10-09 11:40:50 +02:00
parent 8396eba8d9
commit 1e8bbbd1f9
17 changed files with 165 additions and 58 deletions

View File

@ -229,19 +229,25 @@ public final class QRCodeEncoder {
private static String guessAppropriateEncoding(CharSequence contents) { private static String guessAppropriateEncoding(CharSequence contents) {
// Very crude at the moment // Very crude at the moment
for (int i = 0; i < contents.length(); i++) { for (int i = 0; i < contents.length(); i++) {
if (contents.charAt(i) > 0xFF) { return "UTF-8"; } if (contents.charAt(i) > 0xFF) {
return "UTF-8";
}
} }
return null; return null;
} }
private static String trim(String s) { private static String trim(String s) {
if (s == null) { return null; } if (s == null) {
return null;
}
String result = s.trim(); String result = s.trim();
return result.length() == 0 ? null : result; return result.length() == 0 ? null : result;
} }
private static String escapeMECARD(String input) { private static String escapeMECARD(String input) {
if (input == null || (input.indexOf(':') < 0 && input.indexOf(';') < 0)) { return input; } if (input == null || (input.indexOf(':') < 0 && input.indexOf(';') < 0)) {
return input;
}
int length = input.length(); int length = input.length();
StringBuilder result = new StringBuilder(length); StringBuilder result = new StringBuilder(length);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {

View File

@ -1043,16 +1043,24 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
} }
@Override @Override
public App getApp() { return app; } public App getApp() {
return app;
}
@Override @Override
public ApkListAdapter getApks() { return adapter; } public ApkListAdapter getApks() {
return adapter;
}
@Override @Override
public Signature getInstalledSignature() { return mInstalledSignature; } public Signature getInstalledSignature() {
return mInstalledSignature;
}
@Override @Override
public String getInstalledSignatureId() { return mInstalledSigID; } public String getInstalledSignatureId() {
return mInstalledSigID;
}
public static class AppDetailsSummaryFragment extends Fragment { public static class AppDetailsSummaryFragment extends Fragment {
@ -1089,13 +1097,21 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
data = (AppDetailsData) activity; data = (AppDetailsData) activity;
} }
protected App getApp() { return data.getApp(); } protected App getApp() {
return data.getApp();
}
protected ApkListAdapter getApks() { return data.getApks(); } protected ApkListAdapter getApks() {
return data.getApks();
}
protected Signature getInstalledSignature() { return data.getInstalledSignature(); } protected Signature getInstalledSignature() {
return data.getInstalledSignature();
}
protected String getInstalledSignatureId() { return data.getInstalledSignatureId(); } protected String getInstalledSignatureId() {
return data.getInstalledSignatureId();
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -1442,9 +1458,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
.build(); .build();
} }
private App getApp() { return data.getApp(); } private App getApp() {
return data.getApp();
}
private ApkListAdapter getApks() { return data.getApks(); } private ApkListAdapter getApks() {
return data.getApks();
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -1666,9 +1686,13 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
installListener.removeApk(getApp().id); installListener.removeApk(getApp().id);
} }
protected App getApp() { return data.getApp(); } protected App getApp() {
return data.getApp();
}
protected ApkListAdapter getApks() { return data.getApks(); } protected ApkListAdapter getApks() {
return data.getApks();
}
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {

View File

@ -41,7 +41,9 @@ public interface ProgressListener {
} }
@Override @Override
public int describeContents() { return 0; } public int describeContents() {
return 0;
}
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
@ -70,7 +72,9 @@ public interface ProgressListener {
* so we pass that through to the downloader when we set the progress listener. This way, * so we pass that through to the downloader when we set the progress listener. This way,
* we can ask the event for the name of the repo. * we can ask the event for the name of the repo.
*/ */
public Bundle getData() { return data; } public Bundle getData() {
return data;
}
} }
} }

View File

@ -70,11 +70,17 @@ public class RepoUpdater {
this.progressListener = progressListener; this.progressListener = progressListener;
} }
public boolean hasChanged() { return hasChanged; } public boolean hasChanged() {
return hasChanged;
}
public List<App> getApps() { return apps; } public List<App> getApps() {
return apps;
}
public List<Apk> getApks() { return apks; } public List<Apk> getApks() {
return apks;
}
private URL getIndexAddress() throws MalformedURLException { private URL getIndexAddress() throws MalformedURLException {
String urlString = repo.address + "/index.jar"; String urlString = repo.address + "/index.jar";
@ -219,7 +225,9 @@ public class RepoUpdater {
return values; return values;
} }
public RepoUpdateRememberer getRememberer() { return rememberer; } public RepoUpdateRememberer getRememberer() {
return rememberer;
}
public static class RepoUpdateRememberer { public static class RepoUpdateRememberer {

View File

@ -63,19 +63,33 @@ public class RepoXMLHandler extends DefaultHandler {
description = null; description = null;
} }
public List<App> getApps() { return apps; } public List<App> getApps() {
return apps;
}
public List<Apk> getApks() { return apksList; } public List<Apk> getApks() {
return apksList;
}
public int getMaxAge() { return maxage; } public int getMaxAge() {
return maxage;
}
public int getVersion() { return version; } public int getVersion() {
return version;
}
public String getDescription() { return description; } public String getDescription() {
return description;
}
public String getName() { return name; } public String getName() {
return name;
}
public String getSigningCertFromIndexXml() { return signingCertFromIndexXml; } public String getSigningCertFromIndexXml() {
return signingCertFromIndexXml;
}
@Override @Override
public void characters(char[] ch, int start, int length) { public void characters(char[] ch, int start, int length) {

View File

@ -43,5 +43,7 @@ class HoneycombClipboard extends ClipboardCompat {
class OldClipboard extends ClipboardCompat { class OldClipboard extends ClipboardCompat {
@Override @Override
public String getText() { return null; } public String getText() {
return null;
}
} }

View File

@ -424,5 +424,7 @@ public class App extends ValueObject implements Comparable<App> {
return new AppFilter().filter(this); return new AppFilter().filter(this);
} }
public String getSuggestedVersion() { return suggestedVersion; } public String getSuggestedVersion() {
return suggestedVersion;
}
} }

View File

@ -539,17 +539,23 @@ public class AppProvider extends FDroidProvider {
} }
@Override @Override
protected String getTableName() { return DBHelper.TABLE_APP; } protected String getTableName() {
return DBHelper.TABLE_APP;
}
@Override @Override
protected String getProviderName() { return "AppProvider"; } protected String getProviderName() {
return "AppProvider";
}
public static String getAuthority() { public static String getAuthority() {
return AUTHORITY + "." + PROVIDER_NAME; return AUTHORITY + "." + PROVIDER_NAME;
} }
@Override @Override
protected UriMatcher getMatcher() { return matcher; } protected UriMatcher getMatcher() {
return matcher;
}
private AppQuerySelection queryCanUpdate() { private AppQuerySelection queryCanUpdate() {
final String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode "; final String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode ";

View File

@ -100,13 +100,21 @@ public class NewRepoConfig {
} }
public String getBssid() { return bssid; } public String getBssid() {
return bssid;
}
public String getSsid() { return ssid; } public String getSsid() {
return ssid;
}
public int getPort() { return port; } public int getPort() {
return port;
}
public String getRepoUriString() { return uriString; } public String getRepoUriString() {
return uriString;
}
public Uri getRepoUri() { public Uri getRepoUri() {
if (uriString == null) { if (uriString == null) {
@ -115,17 +123,29 @@ public class NewRepoConfig {
return Uri.parse(uriString); return Uri.parse(uriString);
} }
public String getHost() { return host; } public String getHost() {
return host;
}
public String getFingerprint() { return fingerprint; } public String getFingerprint() {
return fingerprint;
}
public boolean isValidRepo() { return isValidRepo; } public boolean isValidRepo() {
return isValidRepo;
}
public boolean isFromSwap() { return fromSwap; } public boolean isFromSwap() {
return fromSwap;
}
public boolean preventFurtherSwaps() { return preventFurtherSwaps; } public boolean preventFurtherSwaps() {
return preventFurtherSwaps;
}
public String getErrorMessage() { return errorMessage; } public String getErrorMessage() {
return errorMessage;
}
/** Sanitize and format an incoming repo URI for function and readability */ /** Sanitize and format an incoming repo URI for function and readability */
public static String sanitizeRepoUri(Uri uri) { public static String sanitizeRepoUri(Uri uri) {

View File

@ -33,9 +33,13 @@ public class QuerySelection {
this.selection = selection; this.selection = selection;
} }
public String[] getArgs() { return args; } public String[] getArgs() {
return args;
}
public String getSelection() { return selection; } public String getSelection() {
return selection;
}
public boolean hasSelection() { public boolean hasSelection() {
return !TextUtils.isEmpty(selection); return !TextUtils.isEmpty(selection);

View File

@ -89,12 +89,18 @@ public class Repo extends ValueObject {
} }
} }
public long getId() { return id; } public long getId() {
return id;
}
public String getName() { return name; } public String getName() {
return name;
}
@Override @Override
public String toString() { return address; } public String toString() {
return address;
}
public boolean isSigned() { public boolean isSigned() {
return !TextUtils.isEmpty(this.pubkey); return !TextUtils.isEmpty(this.pubkey);

View File

@ -281,9 +281,15 @@ public class ApkDownloader implements AsyncDownloader.Listener {
} }
} }
public Apk getApk() { return curApk; } public Apk getApk() {
return curApk;
}
public int getBytesRead() { return dlWrapper != null ? dlWrapper.getBytesRead() : 0; } public int getBytesRead() {
return dlWrapper != null ? dlWrapper.getBytesRead() : 0;
}
public int getTotalBytes() { return dlWrapper != null ? dlWrapper.getTotalBytes() : 0; } public int getTotalBytes() {
return dlWrapper != null ? dlWrapper.getTotalBytes() : 0;
}
} }

View File

@ -168,8 +168,8 @@ public class HttpDownloader extends Downloader {
try { try {
if (stream != null) if (stream != null)
stream.close(); stream.close();
} catch (IOException e) {
} }
catch (IOException e) { }
connection.disconnect(); connection.disconnect();
} }

View File

@ -44,7 +44,9 @@ public class BluetoothServer extends Thread {
start(); start();
} }
public boolean isRunning() { return isRunning; } public boolean isRunning() {
return isRunning;
}
public void close() { public void close() {

View File

@ -154,8 +154,9 @@ public final class Request {
baos.write(b); baos.write(b);
} }
try { Thread.sleep(100); } try {
catch (Exception e) { } Thread.sleep(100);
} catch (Exception e) { }
} }
return line; return line;

View File

@ -44,7 +44,9 @@ public class AppListFragmentPagerAdapter extends FragmentPagerAdapter {
} }
@Override @Override
public int getCount() { return TabManager.INDEX_COUNT; } public int getCount() {
return TabManager.INDEX_COUNT;
}
@Override @Override
public String getPageTitle(int i) { public String getPageTitle(int i) {

View File

@ -68,9 +68,9 @@
<module name="RedundantModifier" /> <module name="RedundantModifier" />
<module name="AvoidNestedBlocks" /> <module name="AvoidNestedBlocks" />
<!--<module name="LeftCurly" />--> <module name="LeftCurly" />
<!--<module name="NeedBraces" />--> <!--<module name="NeedBraces" />-->
<!--<module name="RightCurly" />--> <module name="RightCurly" />
<module name="EmptyStatement" /> <module name="EmptyStatement" />
<!--<module name="HiddenField" />--> <!--<module name="HiddenField" />-->