From d1fb43bf65675d42ce11eaf8fcd05cc6f733005c Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 10 Apr 2019 18:06:56 +0200 Subject: [PATCH] Throw a ParseException on error in the Content. --- src/de/mas/wiiu/jnus/entities/content/Content.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/mas/wiiu/jnus/entities/content/Content.java b/src/de/mas/wiiu/jnus/entities/content/Content.java index 6e06a77..e0992c2 100644 --- a/src/de/mas/wiiu/jnus/entities/content/Content.java +++ b/src/de/mas/wiiu/jnus/entities/content/Content.java @@ -17,6 +17,7 @@ package de.mas.wiiu.jnus.entities.content; import java.nio.ByteBuffer; +import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -67,11 +68,12 @@ public class Content implements Comparable { * @param input * 0x30 byte of data from the TMD (starting at 0xB04) * @return content object + * @throws ParseException */ - public static Content parseContent(byte[] input) { + public static Content parseContent(byte[] input) throws ParseException { if (input == null || input.length != CONTENT_SIZE) { log.info("Error: invalid Content byte[] input"); - return null; + throw new ParseException("Error: invalid Content byte[] input", 0); } ByteBuffer buffer = ByteBuffer.allocate(input.length); buffer.put(input);