checkstyle: Add EqualsAvoidNull
This commit is contained in:
		
							parent
							
								
									174e37e4e0
								
							
						
					
					
						commit
						3f8875ab9c
					
				@ -96,7 +96,7 @@ public class CompatibilityChecker extends Compatibility {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (apk.features != null) {
 | 
					        if (apk.features != null) {
 | 
				
			||||||
            for (final String feat : apk.features) {
 | 
					            for (final String feat : apk.features) {
 | 
				
			||||||
                if (ignoreTouchscreen && feat.equals("android.hardware.touchscreen")) {
 | 
					                if (ignoreTouchscreen && "android.hardware.touchscreen".equals(feat)) {
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (!features.contains(feat)) {
 | 
					                if (!features.contains(feat)) {
 | 
				
			||||||
 | 
				
			|||||||
@ -137,7 +137,7 @@ public class FDroid extends ActionBarActivity {
 | 
				
			|||||||
                        appId = data.getQueryParameter("fdid");
 | 
					                        appId = data.getQueryParameter("fdid");
 | 
				
			||||||
                    } else if (path.startsWith("/app")) {
 | 
					                    } else if (path.startsWith("/app")) {
 | 
				
			||||||
                        appId = data.getLastPathSegment();
 | 
					                        appId = data.getLastPathSegment();
 | 
				
			||||||
                        if (appId != null && appId.equals("app")) {
 | 
					                        if ("app".equals(appId)) {
 | 
				
			||||||
                            appId = null;
 | 
					                            appId = null;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -168,10 +168,10 @@ public class FDroid extends ActionBarActivity {
 | 
				
			|||||||
                    query = data.getQueryParameter("s");
 | 
					                    query = data.getQueryParameter("s");
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if (scheme.equals("fdroid.app")) {
 | 
					        } else if ("fdroid.app".equals(scheme)) {
 | 
				
			||||||
            // fdroid.app:app.id
 | 
					            // fdroid.app:app.id
 | 
				
			||||||
            appId = data.getSchemeSpecificPart();
 | 
					            appId = data.getSchemeSpecificPart();
 | 
				
			||||||
        } else if (scheme.equals("fdroid.search")) {
 | 
					        } else if ("fdroid.search".equals(scheme)) {
 | 
				
			||||||
            // fdroid.search:query
 | 
					            // fdroid.search:query
 | 
				
			||||||
            query = data.getSchemeSpecificPart();
 | 
					            query = data.getSchemeSpecificPart();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -315,8 +315,8 @@ public class FDroidApp extends Application {
 | 
				
			|||||||
            // let's find it
 | 
					            // let's find it
 | 
				
			||||||
            for (ResolveInfo info : pm.queryIntentActivities(sendBt, 0)) {
 | 
					            for (ResolveInfo info : pm.queryIntentActivities(sendBt, 0)) {
 | 
				
			||||||
                bluetoothPackageName = info.activityInfo.packageName;
 | 
					                bluetoothPackageName = info.activityInfo.packageName;
 | 
				
			||||||
                if (bluetoothPackageName.equals("com.android.bluetooth")
 | 
					                if ("com.android.bluetooth".equals(bluetoothPackageName)
 | 
				
			||||||
                        || bluetoothPackageName.equals("com.mediatek.bluetooth")) {
 | 
					                        || "com.mediatek.bluetooth".equals(bluetoothPackageName)) {
 | 
				
			||||||
                    className = info.activityInfo.name;
 | 
					                    className = info.activityInfo.name;
 | 
				
			||||||
                    found = true;
 | 
					                    found = true;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
				
			|||||||
@ -88,7 +88,7 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        super.endElement(uri, localName, qName);
 | 
					        super.endElement(uri, localName, qName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (localName.equals("application") && curapp != null) {
 | 
					        if ("application".equals(localName) && curapp != null) {
 | 
				
			||||||
            apps.add(curapp);
 | 
					            apps.add(curapp);
 | 
				
			||||||
            curapp = null;
 | 
					            curapp = null;
 | 
				
			||||||
            // If the app id is already present in this apps list, then it
 | 
					            // If the app id is already present in this apps list, then it
 | 
				
			||||||
@ -99,7 +99,7 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
            // happen, and I don't *think* it will crash the client, because
 | 
					            // happen, and I don't *think* it will crash the client, because
 | 
				
			||||||
            // the first app will insert, the second one will update the newly
 | 
					            // the first app will insert, the second one will update the newly
 | 
				
			||||||
            // inserted one.
 | 
					            // inserted one.
 | 
				
			||||||
        } else if (localName.equals("package") && curapk != null && curapp != null) {
 | 
					        } else if ("package".equals(localName) && curapk != null && curapp != null) {
 | 
				
			||||||
            apksList.add(curapk);
 | 
					            apksList.add(curapk);
 | 
				
			||||||
            curapk = null;
 | 
					            curapk = null;
 | 
				
			||||||
        } else if (curchars.length() == 0) {
 | 
					        } else if (curchars.length() == 0) {
 | 
				
			||||||
@ -119,12 +119,12 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
                    curapk.size = Utils.parseInt(str, 0);
 | 
					                    curapk.size = Utils.parseInt(str, 0);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case "hash":
 | 
					                case "hash":
 | 
				
			||||||
                    if (hashType == null || hashType.equals("md5")) {
 | 
					                    if (hashType == null || "md5".equals(hashType)) {
 | 
				
			||||||
                        if (curapk.hash == null) {
 | 
					                        if (curapk.hash == null) {
 | 
				
			||||||
                            curapk.hash = str;
 | 
					                            curapk.hash = str;
 | 
				
			||||||
                            curapk.hashType = "MD5";
 | 
					                            curapk.hashType = "MD5";
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else if (hashType.equals("sha256")) {
 | 
					                    } else if ("sha256".equals(hashType)) {
 | 
				
			||||||
                        curapk.hash = str;
 | 
					                        curapk.hash = str;
 | 
				
			||||||
                        curapk.hashType = "SHA-256";
 | 
					                        curapk.hashType = "SHA-256";
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -227,7 +227,7 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
                    curapp.requirements = Utils.CommaSeparatedList.make(str);
 | 
					                    curapp.requirements = Utils.CommaSeparatedList.make(str);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if (localName.equals("description")) {
 | 
					        } else if ("description".equals(localName)) {
 | 
				
			||||||
            description = cleanWhiteSpace(str);
 | 
					            description = cleanWhiteSpace(str);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -237,7 +237,7 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
            Attributes attributes) throws SAXException {
 | 
					            Attributes attributes) throws SAXException {
 | 
				
			||||||
        super.startElement(uri, localName, qName, attributes);
 | 
					        super.startElement(uri, localName, qName, attributes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (localName.equals("repo")) {
 | 
					        if ("repo".equals(localName)) {
 | 
				
			||||||
            signingCertFromIndexXml = attributes.getValue("", "pubkey");
 | 
					            signingCertFromIndexXml = attributes.getValue("", "pubkey");
 | 
				
			||||||
            maxage = Utils.parseInt(attributes.getValue("", "maxage"), -1);
 | 
					            maxage = Utils.parseInt(attributes.getValue("", "maxage"), -1);
 | 
				
			||||||
            version = Utils.parseInt(attributes.getValue("", "version"), -1);
 | 
					            version = Utils.parseInt(attributes.getValue("", "version"), -1);
 | 
				
			||||||
@ -249,16 +249,16 @@ public class RepoXMLHandler extends DefaultHandler {
 | 
				
			|||||||
            if (dc != null)
 | 
					            if (dc != null)
 | 
				
			||||||
                description = cleanWhiteSpace(dc);
 | 
					                description = cleanWhiteSpace(dc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else if (localName.equals("application") && curapp == null) {
 | 
					        } else if ("application".equals(localName) && curapp == null) {
 | 
				
			||||||
            curapp = new App();
 | 
					            curapp = new App();
 | 
				
			||||||
            curapp.id = attributes.getValue("", "id");
 | 
					            curapp.id = attributes.getValue("", "id");
 | 
				
			||||||
        } else if (localName.equals("package") && curapp != null && curapk == null) {
 | 
					        } else if ("package".equals(localName) && curapp != null && curapk == null) {
 | 
				
			||||||
            curapk = new Apk();
 | 
					            curapk = new Apk();
 | 
				
			||||||
            curapk.id = curapp.id;
 | 
					            curapk.id = curapp.id;
 | 
				
			||||||
            curapk.repo = repo.getId();
 | 
					            curapk.repo = repo.getId();
 | 
				
			||||||
            hashType = null;
 | 
					            hashType = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else if (localName.equals("hash") && curapk != null) {
 | 
					        } else if ("hash".equals(localName) && curapk != null) {
 | 
				
			||||||
            hashType = attributes.getValue("", "type");
 | 
					            hashType = attributes.getValue("", "type");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        curchars.setLength(0);
 | 
					        curchars.setLength(0);
 | 
				
			||||||
 | 
				
			|||||||
@ -247,7 +247,7 @@ public final class Utils {
 | 
				
			|||||||
            XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml");
 | 
					            XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml");
 | 
				
			||||||
            int eventType = xml.getEventType();
 | 
					            int eventType = xml.getEventType();
 | 
				
			||||||
            while (eventType != XmlPullParser.END_DOCUMENT) {
 | 
					            while (eventType != XmlPullParser.END_DOCUMENT) {
 | 
				
			||||||
                if (eventType == XmlPullParser.START_TAG && xml.getName().equals("uses-sdk")) {
 | 
					                if (eventType == XmlPullParser.START_TAG && "uses-sdk".equals(xml.getName())) {
 | 
				
			||||||
                    for (int j = 0; j < xml.getAttributeCount(); j++) {
 | 
					                    for (int j = 0; j < xml.getAttributeCount(); j++) {
 | 
				
			||||||
                        if (xml.getAttributeName(j).equals(attrName)) {
 | 
					                        if (xml.getAttributeName(j).equals(attrName)) {
 | 
				
			||||||
                            return Integer.parseInt(xml.getAttributeValue(j));
 | 
					                            return Integer.parseInt(xml.getAttributeValue(j));
 | 
				
			||||||
 | 
				
			|||||||
@ -74,7 +74,7 @@ public class Response {
 | 
				
			|||||||
    public int getFileSize() {
 | 
					    public int getFileSize() {
 | 
				
			||||||
        if (headers != null) {
 | 
					        if (headers != null) {
 | 
				
			||||||
            for (Map.Entry<String, String> entry : headers.entrySet()) {
 | 
					            for (Map.Entry<String, String> entry : headers.entrySet()) {
 | 
				
			||||||
                if (entry.getKey().toLowerCase(Locale.ENGLISH).equals("content-length")) {
 | 
					                if ("content-length".equals(entry.getKey().toLowerCase(Locale.ENGLISH))) {
 | 
				
			||||||
                    try {
 | 
					                    try {
 | 
				
			||||||
                        return Integer.parseInt(entry.getValue());
 | 
					                        return Integer.parseInt(entry.getValue());
 | 
				
			||||||
                    } catch (NumberFormatException e) {
 | 
					                    } catch (NumberFormatException e) {
 | 
				
			||||||
 | 
				
			|||||||
@ -148,7 +148,7 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
 | 
				
			|||||||
        // But it is only available on later Android versions. As such we use URLEncodedUtils instead.
 | 
					        // But it is only available on later Android versions. As such we use URLEncodedUtils instead.
 | 
				
			||||||
        List<NameValuePair> parameters = URLEncodedUtils.parse(URI.create(sharingUri.toString()), "UTF-8");
 | 
					        List<NameValuePair> parameters = URLEncodedUtils.parse(URI.create(sharingUri.toString()), "UTF-8");
 | 
				
			||||||
        for (NameValuePair parameter : parameters) {
 | 
					        for (NameValuePair parameter : parameters) {
 | 
				
			||||||
            if (!parameter.getName().equals("ssid")) {
 | 
					            if (!"ssid".equals(parameter.getName())) {
 | 
				
			||||||
                if (first) {
 | 
					                if (first) {
 | 
				
			||||||
                    qrUriString += "?";
 | 
					                    qrUriString += "?";
 | 
				
			||||||
                    first = false;
 | 
					                    first = false;
 | 
				
			||||||
 | 
				
			|||||||
@ -73,6 +73,7 @@
 | 
				
			|||||||
        <module name="UpperEll" />
 | 
					        <module name="UpperEll" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <module name="StringLiteralEquality" />
 | 
					        <module name="StringLiteralEquality" />
 | 
				
			||||||
 | 
					        <module name="EqualsAvoidNull" />
 | 
				
			||||||
        <!--<module name="EqualsHashCode" />-->
 | 
					        <!--<module name="EqualsHashCode" />-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </module>
 | 
					    </module>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user