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

Gary D. Gregory updated IO-705:
-------------------------------
    Summary: MarkShieldInputStream#reset should throw 
UnsupportedOperationException  (was: MarkShieldInputStream#reset is more 
reasonable to throw UnsupportedOperationException)

> MarkShieldInputStream#reset should throw UnsupportedOperationException
> ----------------------------------------------------------------------
>
>                 Key: IO-705
>                 URL: https://issues.apache.org/jira/browse/IO-705
>             Project: Commons IO
>          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)

Reply via email to