Throw a ParseException instead of returning null in the ContentInfo

This commit is contained in:
Maschell 2019-04-10 18:47:57 +02:00
parent 651e32e7ba
commit 422c36dde3

View File

@ -17,6 +17,7 @@
package de.mas.wiiu.jnus.entities.content; package de.mas.wiiu.jnus.entities.content;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -62,11 +63,12 @@ public class ContentInfo {
* @param input * @param input
* 0x24 byte of data from the TMD (starting at 0x208) * 0x24 byte of data from the TMD (starting at 0x208)
* @return ContentFSTInfo object * @return ContentFSTInfo object
* @throws ParseException
*/ */
public static ContentInfo parseContentInfo(byte[] input) { public static ContentInfo parseContentInfo(byte[] input) throws ParseException {
if (input == null || input.length != CONTENT_INFO_SIZE) { if (input == null || input.length != CONTENT_INFO_SIZE) {
log.info("Error: invalid ContentInfo byte[] input"); log.info("Error: invalid ContentInfo byte[] input");
return null; throw new ParseException("Error: invalid ContentInfo byte[] input", 0);
} }
ByteBuffer buffer = ByteBuffer.allocate(input.length); ByteBuffer buffer = ByteBuffer.allocate(input.length);