Hao Zhong created PDFBOX-5083:
---------------------------------
Summary: MarkShieldInputStream#reset is more reasonable to throw
UnsupportedOperationException
Key: PDFBOX-5083
URL: https://issues.apache.org/jira/browse/PDFBOX-5083
Project: PDFBox
Issue Type: Bug
Reporter: Hao Zhong
The code of MarkShieldInputStream#reset is as follows:
{code:java}
public void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
{code}
The message indicates that it is better to throw UnsupportedOperationException.
Indeed, otehr classes throw that exception in similar contexts:
WindowsLineEndingInputStream#mark
{code:java}
public synchronized void mark(final int readlimit) {
throw new UnsupportedOperationException("Mark not supported");
}
{code}
NullReader#reset:
{code:java}
public synchronized void reset() throws IOException {
if (!markSupported) {
throw new UnsupportedOperationException("Mark not supported");
}
if (mark < 0) {
throw new IOException("No position has been marked");
}
if (position > mark + readlimit) {
throw new IOException("Marked position [" + mark +
"] is no longer valid - passed the read limit [" +
readlimit + "]");
}
position = mark;
eof = false;
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]