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

zhihai xu commented on HADOOP-8437:
-----------------------------------

By the way, a much easier way for a test case may be just to change the 
configuration to a string with only white space.
For example, run the following code:
{code}
    conf1.set(CONTEXT, " ");
    dirAllocator.getLocalPathForWrite("/test", conf1);
{code}
You can get the following exception:
{code}
java.lang.IllegalArgumentException: n must be positive
        at java.util.Random.nextInt(Random.java:300)
        at 
org.apache.hadoop.fs.LocalDirAllocator$AllocatorPerContext.confChanged(LocalDirAllocator.java:308)
        at 
org.apache.hadoop.fs.LocalDirAllocator$AllocatorPerContext.getLocalPathForWrite(LocalDirAllocator.java:347)
        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:320)
{code}

> getLocalPathForWrite is not throwing any expection for invalid paths
> --------------------------------------------------------------------
>
>                 Key: HADOOP-8437
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8437
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.0.0-alpha, 2.6.0, 3.0.0
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>              Labels: BB2015-05-TBR
>         Attachments: HADOOP-8437-003.patch, HADOOP-8437.patch, 
> HADOOP-8437_1.patch, HADOOP-8437_2.patch
>
>
> call dirAllocator.getLocalPathForWrite ( "/InvalidPath", conf );
> Here it will not thrown any exception but earlier version it used throw.



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

Reply via email to