Added Java 1.7 support.

This commit is contained in:
Felix Ableitner 2014-08-05 19:50:47 +02:00
parent 921c5bf4a3
commit 33bfefa4a1
2 changed files with 9 additions and 5 deletions

View file

@ -58,6 +58,11 @@ android {
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
} }
dependencies { dependencies {

View file

@ -61,7 +61,7 @@ public class CertificateManager {
String[] list = (system) String[] list = (system)
? SYSTEM_CERTIFICATES_DIR.list() ? SYSTEM_CERTIFICATES_DIR.list()
: USER_CERTIFICATES_DIR.list(); : USER_CERTIFICATES_DIR.list();
ArrayList<Certificate> ret = new ArrayList<Certificate>(); ArrayList<Certificate> ret = new ArrayList<>();
for (String file : list) { for (String file : list) {
ret.add(new Certificate(file, system)); ret.add(new Certificate(file, system));
} }
@ -142,12 +142,11 @@ public class CertificateManager {
CertificateFactory factory = CertificateFactory.getInstance("X509"); CertificateFactory factory = CertificateFactory.getInstance("X509");
is = new BufferedInputStream(new FileInputStream(cert.getFile())); is = new BufferedInputStream(new FileInputStream(cert.getFile()));
cert2 = (X509Certificate) factory.generateCertificate(is); cert2 = (X509Certificate) factory.generateCertificate(is);
} catch (IOException e) { } catch (IOException | CertificateException e) {
return null;
} catch (CertificateException e) {
return null; return null;
} finally { } finally {
try { try {
// TODO: crash here
is.close(); is.close();
} }
catch (IOException e) { catch (IOException e) {
@ -179,7 +178,7 @@ public class CertificateManager {
secondary = ""; secondary = "";
} }
} }
return new Pair<String, String>(primary, secondary); return new Pair<>(primary, secondary);
} }
public boolean isMovingCertificate(Certificate cert) { public boolean isMovingCertificate(Certificate cert) {