Making Utf8StringBuilder actually throw a NotUtf8Exception in the case of an incomplete UTF8 sequence

This commit is contained in:
Joakim Erdfelt 2012-08-01 12:58:32 -07:00
parent 4b59767bd2
commit 2f4c86be35
2 changed files with 2 additions and 1 deletions

View File

@ -179,6 +179,7 @@ public abstract class Utf8Appendable
return _state == UTF8_ACCEPT;
}
@SuppressWarnings("serial")
public static class NotUtf8Exception extends IllegalArgumentException
{
public NotUtf8Exception(String reason)

View File

@ -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");
}
}