From 3084b352ef269a82dc9692220c4d6c6677a653bd Mon Sep 17 00:00:00 2001 From: Chuck Ritola Date: Tue, 16 Apr 2024 20:52:07 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=94Use=20returnClass=20to=20avoid=20nulls?= =?UTF-8?q?,=20reset=20on=20EOF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/jtrfp/jfdt/Parser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jtrfp/jfdt/Parser.java b/src/main/java/org/jtrfp/jfdt/Parser.java index 0c04210..d8fad77 100644 --- a/src/main/java/org/jtrfp/jfdt/Parser.java +++ b/src/main/java/org/jtrfp/jfdt/Parser.java @@ -239,7 +239,7 @@ private CLASS get(ThirdPartyParseable obj, String property, Class )result).ordinal()+""); } return (CLASS)method.invoke(obj, (Object[])null); @@ -558,9 +558,11 @@ public void read(EndianAwareDataInputStream is, is.mark(b.length); try{is.readFully(b);} catch(EOFException e){ + is.reset(); throw new EOFException("Occurred at byte "+readTally+" (0x"+Long.toHexString(readTally).toUpperCase()+")"); // FLIP_ENDIAN isn't going to help here so it won't be considered. }catch(Exception e) { + is.reset(); if(failureBehavior == FailureBehavior.UNRECOGNIZED_FORMAT) throw new UnrecognizedFormatException("Occurred at byte "+readTally+" (0x"+Long.toHexString(readTally).toUpperCase()+")",e); else