From 2f4c86be354717f7d1b9775f1aca73d379750802 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 1 Aug 2012 12:58:32 -0700 Subject: [PATCH] Making Utf8StringBuilder actually throw a NotUtf8Exception in the case of an incomplete UTF8 sequence --- .../src/main/java/org/eclipse/jetty/util/Utf8Appendable.java | 1 + .../src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java index de02cc4e3f4..0869f3dae85 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8Appendable.java @@ -179,6 +179,7 @@ public abstract class Utf8Appendable return _state == UTF8_ACCEPT; } + @SuppressWarnings("serial") public static class NotUtf8Exception extends IllegalArgumentException { public NotUtf8Exception(String reason) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java index 09866884eae..b42f1d5f7ed 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Utf8StringBuilder.java @@ -72,6 +72,6 @@ public class Utf8StringBuilder extends Utf8Appendable private void checkState() { if (!isUtf8SequenceComplete()) - throw new IllegalArgumentException("Tried to read incomplete UTF8 decoded String"); + throw new NotUtf8Exception("Tried to read incomplete UTF8 decoded String"); } }