hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14788) Credentials readTokenStorageFile to stop wrapping IOEs in IOEs
Date Thu, 11 Jan 2018 19:47:05 GMT

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

Steve Loughran commented on HADOOP-14788:
-----------------------------------------


h3. Exception type
  
I just like the fact that PathIOE preserves that path, and having something typed better than
just IOE is useful.
If you look at the subclasses of that path, you can see that its gone to more than just the
original set of Posix calls, though I will add the caveat, I think that most of those subclasses
are mine.

The key thing is: a subclass of IOE is better in try/catch and tests

.h3 tests

And, on the toopic of tests, I'd like them split in two, and I'm going to propose moving to
LambdaTestUtils.intercept, for the java8 way to handle this.
To backport to Branch2, IntelliJ will convert the lambda-expression into an anonymous class
at the click of a button.

Here's my conversion of the calls      
{code}
EOFException returnedEx = LambdaTestUtils(EOFException.class, 
  "Failed with "
        + "java.io.EOFException while processing file/directory "
        + ":[/tmp/abc.txt] in method:[testWrapException]"
    ()-> IOUtils.wrapException("/tmp/abc.txt", "testWrapEx", ex));

{code}

Second one

{code}

PathIOException returnedEx = LambdaTestUtils(PathIOException.class, "Input/output error:",

    ()-> IOUtils.wrapException("/tmp/abc.txt", "testWrapEx", ex));
 assertEquals("/tmp/abc.txt", returnedEx.getPath().toString());

{code}




> Credentials readTokenStorageFile to stop wrapping IOEs in IOEs
> --------------------------------------------------------------
>
>                 Key: HADOOP-14788
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14788
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 2.8.1
>            Reporter: Steve Loughran
>            Assignee: Ajay Kumar
>            Priority: Minor
>         Attachments: HADOOP-14788.001.patch, HADOOP-14788.002.patch, HADOOP-14788.003.patch,
HADOOP-14788.004.patch
>
>
> When {{Credentials readTokenStorageFile}} gets an IOE. it catches & wraps with the
filename, so losing the exception class information.
> Is this needed. or can it pass everything up?
> If it is needed, well, it's a common pattern: wrapping the exception with the path &
operation. Maybe it's time to add an IOE version of {{NetworkUtils.wrapException()}} which
handles the broader set of IOEs



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message