[ 
https://issues.apache.org/jira/browse/BEAM-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15990097#comment-15990097
 ] 

Kenneth Knowles edited comment on BEAM-1773 at 4/30/17 2:11 AM:
----------------------------------------------------------------

Checked exceptions should be understood as an alternative return value, 
basically. I am OK with adding a checked exception if it is a specific 
{{ValidationException}}. The source should add its own error message so the 
user knows what is going on. So you still have to wrap it. We should not add 
checked exceptions that automatically trickle up.

Incidentally, I don't think the way that {{InterruptedException}} is handled 
there is correct. It should _definitely_ not be thrown by {{validate}}. It 
should instead catch those two exceptions separately and handle interruption 
via {{Thread.currentThread().interrupt(); return;}}. See 
http://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java


was (Author: kenn):
Checked exceptions should be understood as an alternative return value, 
basically. I am OK with adding a checked exception if it is a specific 
{{ValidationException}}. The source should add its own error message so the 
user knows what is going on. So you still have to wrap it. We should not add 
checked exceptions that automatically trickle up.

Incidentally, I don't think the way that {{InterruptedException}} is handled 
there is correct. It should _definitely_ not be thrown by {{validate}}. It 
should instead catch those two exceptions separately and handle interruption 
via {{Thread.currentThread().interrupt(); return;}}

> Consider allowing Source#validate() to throw exception
> ------------------------------------------------------
>
>                 Key: BEAM-1773
>                 URL: https://issues.apache.org/jira/browse/BEAM-1773
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>         Attachments: beam-1773.v1.patch, beam-1773.v2.patch
>
>
> In HDFSFileSource.java :
> {code}
>   @Override
>   public void validate() {
> ...
>       } catch (IOException | InterruptedException e) {
>         throw new RuntimeException(e);
>       }
> {code}
> Source#validate() should be allowed to throw exception so that we don't 
> resort to using RuntimeException.
> Here was related thread on mailing list:
> http://search-hadoop.com/m/Beam/gfKHFOwE0uETxae?subj=Re+why+Source+validate+is+not+declared+to+throw+any+exception



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to