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

zhihai xu commented on HADOOP-12252:
------------------------------------

The following is the stack trace for the NPE:
{code}
2015-07-22 14:33:43,338 INFO  fs.TestLocalDirAllocator 
(TestLocalDirAllocator.java:testShouldNotthrowNPE(332)) - NPE
java.lang.NullPointerException
        at 
org.apache.hadoop.fs.LocalDirAllocator$AllocatorPerContext.getLocalPathForWrite(LocalDirAllocator.java:348)
        at 
org.apache.hadoop.fs.LocalDirAllocator.getLocalPathForWrite(LocalDirAllocator.java:150)
        at 
org.apache.hadoop.fs.LocalDirAllocator.getLocalPathForWrite(LocalDirAllocator.java:131)
        at 
org.apache.hadoop.fs.LocalDirAllocator.getLocalPathForWrite(LocalDirAllocator.java:115)
        at 
org.apache.hadoop.fs.TestLocalDirAllocator.testShouldNotthrowNPE(TestLocalDirAllocator.java:325)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

2015-07-22 14:38:54,769 INFO  fs.TestLocalDirAllocator 
(TestLocalDirAllocator.java:testShouldNotthrowNPE(345)) - NPE
java.lang.NullPointerException
        at 
org.apache.hadoop.fs.LocalDirAllocator$AllocatorPerContext.getLocalPathToRead(LocalDirAllocator.java:436)
        at 
org.apache.hadoop.fs.LocalDirAllocator.getLocalPathToRead(LocalDirAllocator.java:164)
        at 
org.apache.hadoop.fs.TestLocalDirAllocator.testShouldNotthrowNPE(TestLocalDirAllocator.java:338)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)
{code}
{{newLocalDirs.equals(savedLocalDirs)}} will be true with empty string 
configuration in {{AllocatorPerContext#confChanged}}

> LocalDirAllocator should not throw NPE with empty string configuration. 
> ------------------------------------------------------------------------
>
>                 Key: HADOOP-12252
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12252
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>         Attachments: HADOOP-12252.000.patch
>
>
> LocalDirAllocator should not throw NPE with empty string configuration. When 
> an empty string is configured, {{LocalDirAllocator}} will throw NPE. It will 
> be better to throw IOException instead of NPE.



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

Reply via email to