Commit 62263105 by Googler Committed by Tofunmi Adigun-Hameed

Override ParserException#getMessage

PiperOrigin-RevId: 537908595
(cherry picked from commit f8be8c087de550d2d7a2d1c1b7dc9591804c93f8)
parent 82fcbd20
...@@ -105,4 +105,15 @@ public class ParserException extends IOException { ...@@ -105,4 +105,15 @@ public class ParserException extends IOException {
this.contentIsMalformed = contentIsMalformed; this.contentIsMalformed = contentIsMalformed;
this.dataType = dataType; this.dataType = dataType;
} }
@Nullable
@Override
public String getMessage() {
return super.getMessage()
+ "{contentIsMalformed="
+ contentIsMalformed
+ ", dataType="
+ dataType
+ "}";
}
} }
...@@ -116,7 +116,8 @@ public final class VorbisUtilTest { ...@@ -116,7 +116,8 @@ public final class VorbisUtilTest {
VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false); VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false);
fail(); fail();
} catch (ParserException e) { } catch (ParserException e) {
assertThat(e.getMessage()).isEqualTo("expected header type 99"); assertThat(e.getMessage())
.isEqualTo("expected header type 99{contentIsMalformed=true, dataType=1}");
} }
} }
...@@ -136,7 +137,8 @@ public final class VorbisUtilTest { ...@@ -136,7 +137,8 @@ public final class VorbisUtilTest {
VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false); VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false);
fail(); fail();
} catch (ParserException e) { } catch (ParserException e) {
assertThat(e.getMessage()).isEqualTo("expected characters 'vorbis'"); assertThat(e.getMessage())
.isEqualTo("expected characters 'vorbis'{contentIsMalformed=true, dataType=1}");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment