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

Chris Nauroth commented on HADOOP-12551:
----------------------------------------

bq. While submitting the patch I built it using checkstyle flag, but didn't 
find any new style check warnings.

I forgot that hadoop-azure has an overridden checkstyle.xml.  That's something 
to clean up and align with the rest of the codebase at some point, but not in 
scope of this JIRA.

bq. I have commented the code explaining that we would not be hitting the 
NullReferenceException in the code path that the warnings are raised.

I think Findbugs correctly spotted a bug, but it's in the exception handling:

{code}
      if (renamed) {
       listing = null;
       try {
         listing = store.list(key, AZURE_LIST_ALL, 1, partialKey);
       } catch (IOException ex) {
         Throwable innerException = 
NativeAzureFileSystem.checkForAzureStorageException(ex);

         if (innerException instanceof StorageException) {
           if (NativeAzureFileSystem.isFileNotFoundException((StorageException) 
innerException)) {
             throw new FileNotFoundException(String.format("%s is not found", 
key));
           }
         } else {
           throw ex;
         }
       }
      }
{code}

If the exception is a {{StorageException}}, but not a 
{{FileNotFoundException}}, then the {{StorageException}} is swallowed instead 
of propagated to the caller.  Findbugs has identified correctly that there is a 
potential code path for execution to continue and dereference {{listing}}, 
which would be {{null}}.  I recommend changing the exception handling to this:

{code}
       } catch (IOException ex) {
         Throwable innerException = 
NativeAzureFileSystem.checkForAzureStorageException(ex);

         if (innerException != null &&
             innerException instanceof StorageException &&
             NativeAzureFileSystem.isFileNotFoundException((StorageException) 
innerException)) {
           throw new FileNotFoundException(String.format("%s is not found", 
key));
         } else {
           throw ex;
         }
       }
{code}


> Introduce FileNotFoundException for WASB FileSystem API
> -------------------------------------------------------
>
>                 Key: HADOOP-12551
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12551
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: tools
>    Affects Versions: 2.7.1
>            Reporter: Dushyanth
>            Assignee: Dushyanth
>         Attachments: HADOOP-12551.001.patch, HADOOP-12551.002.patch
>
>
> HADOOP-12533 introduced FileNotFoundException to the read and seek API for 
> WASB. The open and getFileStatus api currently throws FileNotFoundException 
> correctly when the file does not exists when the API is called but does not 
> throw the same exception if there is another thread/process deletes the file 
> during its execution. This Jira fixes that behavior.
> This jira also re-examines other Azure storage store calls to check for 
> BlobNotFoundException in setPermission(), setOwner, rename(), delete(), 
> open(), listStatus() APIs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to