Making Utf8StringBuilder actually throw a NotUtf8Exception in the case of an incomplete UTF8 sequence
This commit is contained in:
parent
4b59767bd2
commit
2f4c86be35
|
@ -179,6 +179,7 @@ public abstract class Utf8Appendable
|
|||
return _state == UTF8_ACCEPT;
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class NotUtf8Exception extends IllegalArgumentException
|
||||
{
|
||||
public NotUtf8Exception(String reason)
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue