Fix NPE issues seen by CTS

Bug: 8646305
Change-Id: Ief90c76d63f60aee9a3da080cd43dd9610f3f4fc
This commit is contained in:
Irfan Sheriff
2013-04-19 10:43:40 -07:00
parent 40843589c4
commit 0b4732c224

View File

@@ -417,10 +417,14 @@ public class WifiEnterpriseConfig implements Parcelable {
* @throws IllegalArgumentException if not a CA certificate
*/
public void setCaCertificate(X509Certificate cert) {
if (cert.getBasicConstraints() >= 0) {
mCaCert = cert;
if (cert != null) {
if (cert.getBasicConstraints() >= 0) {
mCaCert = cert;
} else {
throw new IllegalArgumentException("Not a CA certificate");
}
} else {
throw new IllegalArgumentException("Not a CA certificate");
mCaCert = null;
}
}
@@ -683,6 +687,7 @@ public class WifiEnterpriseConfig implements Parcelable {
}
private String removeDoubleQuotes(String string) {
if (TextUtils.isEmpty(string)) return "";
int length = string.length();
if ((length > 1) && (string.charAt(0) == '"')
&& (string.charAt(length - 1) == '"')) {