You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "zhihai xu (JIRA)" <ji...@apache.org> on 2014/09/03 08:50:51 UTC

[jira] [Updated] (HADOOP-11035) distcp on mr1(branch-1) fails with NPE using a short relative source path.

     [ https://issues.apache.org/jira/browse/HADOOP-11035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

zhihai xu updated HADOOP-11035:
-------------------------------
    Attachment: HADOOP-11035.000.patch

I uploaded the patch to fix the issue.  I added a test case.
Without the fix, the following NPE will happen:

Copy failed: java.lang.NullPointerException
	at org.apache.hadoop.io.Text.encode(Text.java:388)
	at org.apache.hadoop.io.Text.encode(Text.java:369)
	at org.apache.hadoop.io.Text.writeString(Text.java:409)
	at org.apache.hadoop.tools.DistCp$FilePair.write(DistCp.java:237)
	at org.apache.hadoop.io.serializer.WritableSerialization$WritableSerializer.serialize(WritableSerialization.java:90)
	at org.apache.hadoop.io.serializer.WritableSerialization$WritableSerializer.serialize(WritableSerialization.java:77)
	at org.apache.hadoop.io.SequenceFile$Writer.append(SequenceFile.java:1068)
	at org.apache.hadoop.io.SequenceFile$Writer.append(SequenceFile.java:1039)
	at org.apache.hadoop.tools.DistCp.setup(DistCp.java:1163)
	at org.apache.hadoop.tools.DistCp.copy(DistCp.java:668)
	at org.apache.hadoop.tools.DistCp.run(DistCp.java:883)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
	at org.apache.hadoop.fs.TestCopyFiles.testCopyFromLocalToLocalUsingRelativePathName(TestCopyFiles.java:296)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)


> distcp on mr1(branch-1) fails with NPE using a short relative source path.
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-11035
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11035
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: tools
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>         Attachments: HADOOP-11035.000.patch
>
>
> distcp on mr1(branch-1) fails with NPE using a short relative source path. 
> The failure is at DistCp.java, makeRelative return null at the following code:
> The parameters passed to makeRelative are not same format:
> root is relative path and child.getPath() is a full path.
> {code}
> final String dst = makeRelative(root, child.getPath());
> {code}
> The solution is 
> change root to full path to match child.getPath().



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