LWJGLInstaller should check for non-existing master directory. Use exceptions instead of boolean status code in verifyCerts
This commit is contained in:
parent
8ffd193467
commit
0f4df46e9b
|
@ -189,9 +189,7 @@ public class LWJGLInstaller {
|
||||||
files.put(native_entry.getName(), baos.toByteArray());
|
files.put(native_entry.getName(), baos.toByteArray());
|
||||||
|
|
||||||
// now check the chain of an actual file
|
// now check the chain of an actual file
|
||||||
if(!validateCertificateChain(ownCerts, native_entry.getCertificates())) {
|
validateCertificateChain(ownCerts, native_entry.getCertificates());
|
||||||
throw new Exception("Failed to validate certificate chain for " + native_entry.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
|
@ -206,24 +204,18 @@ public class LWJGLInstaller {
|
||||||
* @param native_certs Chain of certificates to check
|
* @param native_certs Chain of certificates to check
|
||||||
* @return true if the chains match
|
* @return true if the chains match
|
||||||
*/
|
*/
|
||||||
private static boolean validateCertificateChain(Certificate[] ownCerts, Certificate[] native_certs) {
|
private static void validateCertificateChain(Certificate[] ownCerts, Certificate[] native_certs) throws Exception {
|
||||||
if(native_certs == null) {
|
if(native_certs == null)
|
||||||
LWJGLUtil.log("Unable to validate certificate chain. Native entry did not have a certificate chain at all");
|
throw new Exception("Unable to validate certificate chain. Native entry did not have a certificate chain at all");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ownCerts.length != native_certs.length) {
|
if(ownCerts.length != native_certs.length)
|
||||||
LWJGLUtil.log("Unable to validate certificate chain. Chain differs in length [" + ownCerts.length + " vs " + native_certs.length + "]");
|
throw new Exception("Unable to validate certificate chain. Chain differs in length [" + ownCerts.length + " vs " + native_certs.length + "]");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i=0; i<ownCerts.length; i++) {
|
for(int i=0; i<ownCerts.length; i++) {
|
||||||
if(!ownCerts[i].equals(native_certs[i])) {
|
if(!ownCerts[i].equals(native_certs[i])) {
|
||||||
LWJGLUtil.log("Certificate mismatch: " + ownCerts[i] + " != " + native_certs[i]);
|
throw new Exception("Certificate mismatch: " + ownCerts[i] + " != " + native_certs[i]);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,10 +336,12 @@ public class LWJGLInstaller {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (files != null) {
|
||||||
// uninstall each of the dirs
|
// uninstall each of the dirs
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
uninstall(files[i]);
|
uninstall(files[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue