mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-26 01:44:17 +01:00
Throw a ParseException on error in the TMD.
This commit is contained in:
parent
7869fa42b6
commit
9ecd9825b5
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -102,17 +103,17 @@ public final class TMD {
|
|||||||
this.cert2 = param.getCert2();
|
this.cert2 = param.getCert2();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TMD parseTMD(File tmd) throws IOException {
|
public static TMD parseTMD(File tmd) throws IOException, ParseException {
|
||||||
if (tmd == null || !tmd.exists()) {
|
if (tmd == null || !tmd.exists()) {
|
||||||
log.info("TMD input file null or doesn't exist.");
|
log.info("TMD input file null or doesn't exist.");
|
||||||
return null;
|
throw new IOException("TMD input file null or doesn't exist.");
|
||||||
}
|
}
|
||||||
return parseTMD(Files.readAllBytes(tmd.toPath()));
|
return parseTMD(Files.readAllBytes(tmd.toPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TMD parseTMD(byte[] input) {
|
public static TMD parseTMD(byte[] input) throws ParseException {
|
||||||
if (input == null || input.length == 0) {
|
if (input == null || input.length == 0) {
|
||||||
throw new RuntimeException("Invalid TMD file.");
|
throw new ParseException("Invalid TMD file.", 0);
|
||||||
}
|
}
|
||||||
byte[] signature = new byte[SIGNATURE_LENGTH];
|
byte[] signature = new byte[SIGNATURE_LENGTH];
|
||||||
byte[] issuer = new byte[ISSUER_LENGTH];
|
byte[] issuer = new byte[ISSUER_LENGTH];
|
||||||
|
Loading…
Reference in New Issue
Block a user