summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2013-04-19 10:43:40 -0700
committerIrfan Sheriff <isheriff@google.com>2013-04-19 10:54:48 -0700
commit0b4732c2248fa2b92a44f045dfcadb3547076ef4 (patch)
treed067cfc984440704fc1a9444b718a2a3eea2e024 /wifi
parent40843589c46164c90fde29ad1c58291f17d4d9e6 (diff)
downloadframeworks_base-0b4732c2248fa2b92a44f045dfcadb3547076ef4.zip
frameworks_base-0b4732c2248fa2b92a44f045dfcadb3547076ef4.tar.gz
frameworks_base-0b4732c2248fa2b92a44f045dfcadb3547076ef4.tar.bz2
Fix NPE issues seen by CTS
Bug: 8646305 Change-Id: Ief90c76d63f60aee9a3da080cd43dd9610f3f4fc
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiEnterpriseConfig.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
index f8a8196..daa04a4 100644
--- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
+++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
@@ -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) == '"')) {