You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (Jira)" <ji...@apache.org> on 2021/01/20 05:31:00 UTC

[jira] [Closed] (PDFBOX-5083) MarkShieldInputStream#reset is more reasonable to throw UnsupportedOperationException

     [ https://issues.apache.org/jira/browse/PDFBOX-5083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler closed PDFBOX-5083.
--------------------------------------
    Resolution: Invalid

> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org