Loading src/java/com/android/internal/telephony/CarrierKeyDownloadManager.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -60,6 +60,7 @@ import java.security.cert.X509Certificate; import java.util.Date; import java.util.Date; import java.util.Random; import java.util.Random; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream; import java.util.zip.ZipException; /** /** * This class contains logic to get Certificates and keep them current. * This class contains logic to get Certificates and keep them current. Loading Loading @@ -403,11 +404,15 @@ public class CarrierKeyDownloadManager extends Handler { private static String convertToString(InputStream is) { private static String convertToString(InputStream is) { try { try { // The current implementation at certain Carriers has the data gzipped, which requires // If the carrier does not have the data gzipped, fallback to assuming it is not zipped. // us to unzip the contents. Longer term, we want to add a flag in carrier config which // parseJsonAndPersistKey may still fail if the data is malformed, so we won't be // determines if the data needs to be zipped or not. // persisting random bogus strings thinking it's the cert GZIPInputStream gunzip = new GZIPInputStream(is); try { BufferedReader reader = new BufferedReader(new InputStreamReader(gunzip, UTF_8)); is = new GZIPInputStream(is); } catch (ZipException e) { Log.d(LOG_TAG, "fallback to no gzip"); } BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8)); StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder(); String line; String line; Loading Loading
src/java/com/android/internal/telephony/CarrierKeyDownloadManager.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -60,6 +60,7 @@ import java.security.cert.X509Certificate; import java.util.Date; import java.util.Date; import java.util.Random; import java.util.Random; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream; import java.util.zip.ZipException; /** /** * This class contains logic to get Certificates and keep them current. * This class contains logic to get Certificates and keep them current. Loading Loading @@ -403,11 +404,15 @@ public class CarrierKeyDownloadManager extends Handler { private static String convertToString(InputStream is) { private static String convertToString(InputStream is) { try { try { // The current implementation at certain Carriers has the data gzipped, which requires // If the carrier does not have the data gzipped, fallback to assuming it is not zipped. // us to unzip the contents. Longer term, we want to add a flag in carrier config which // parseJsonAndPersistKey may still fail if the data is malformed, so we won't be // determines if the data needs to be zipped or not. // persisting random bogus strings thinking it's the cert GZIPInputStream gunzip = new GZIPInputStream(is); try { BufferedReader reader = new BufferedReader(new InputStreamReader(gunzip, UTF_8)); is = new GZIPInputStream(is); } catch (ZipException e) { Log.d(LOG_TAG, "fallback to no gzip"); } BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8)); StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder(); String line; String line; Loading