[
https://issues.apache.org/jira/browse/PDFBOX-5083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17268368#comment-17268368
]
Hao Zhong commented on PDFBOX-5083:
-----------------------------------
Please delete this report. I report it to a wrong project. :)
> 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
> Priority: Major
>
> 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]