Bug 185379 - NPE in FileDiffResult.calculateFuzz
Summary: NPE in FileDiffResult.calculateFuzz
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.3   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-05-03 12:13 EDT by Stefan Xenos CLA
Modified: 2007-06-05 15:14 EDT (History)
1 user (show)

See Also:
Michael.Valenta: review+


Attachments
Patch (875 bytes, patch)
2007-05-08 03:47 EDT, Tomasz Zarna CLA
no flags Details | Diff
Test case (1.81 KB, patch)
2007-05-18 10:35 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Xenos CLA 2007-05-03 12:13:25 EDT
A user of our RCP app reported the following exception with no steps to reproduce.

It seems that ApplyPatchOperation created a FileDiff containing a null newPath, and that calculateFuzz was unable to deal with this situation. I'm not sure how to construct a patch that results in a null path, but I suspect a compare bug since the object was constructed by Eclipse compare code and that's where the exception was thrown.


java.lang.NullPointerException
	at org.eclipse.compare.internal.patch.FileDiffResult.calculateFuzz(FileDiffResult.java:220)
	at org.eclipse.compare.internal.patch.FileDiffResult.patch(FileDiffResult.java:148)
	at org.eclipse.compare.internal.patch.FileDiffResult.refresh(FileDiffResult.java:101)
	at org.eclipse.compare.internal.patch.FileDiff.apply(FileDiff.java:178)
	at com.ibm.team.filesystem.ui.views.ApplyPatchUtil.applyFilePatch(ApplyPatchUtil.java:889)
	at com.ibm.team.filesystem.ui.views.ApplyPatchUtil.access$0(ApplyPatchUtil.java:883)
	at com.ibm.team.filesystem.ui.views.ApplyPatchUtil$4.run(ApplyPatchUtil.java:767)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1779)
	at com.ibm.team.filesystem.ui.views.ApplyPatchUtil.doApplyPatch(ApplyPatchUtil.java:750)
	at com.ibm.team.filesystem.ui.views.ApplyPatchUtil$3$1$1.repositoryRun(ApplyPatchUtil.java:394)
	at com.ibm.team.repository.rcp.ui.operations.RepositoryOperation.run(RepositoryOperation.java:20)
	at com.ibm.team.repository.rcp.ui.operations.JobRunner.run(JobRunner.java:107)
	at com.ibm.team.repository.rcp.ui.operations.JobRunner.access$0(JobRunner.java:80)
	at com.ibm.team.repository.rcp.ui.operations.JobRunner$1.run(JobRunner.java:40)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Michael Valenta CLA 2007-05-03 13:55:50 EDT
Fix is trivial so we will consider for RC1.
Comment 2 Tomasz Zarna CLA 2007-05-08 03:47:19 EDT
Created attachment 66251 [details]
Patch

Hope this will prevent from throwing NPE in that line.
Comment 3 Michael Valenta CLA 2007-05-08 09:34:51 EDT
Patch reviewed and released to HEAD
Comment 4 Tomasz Zarna CLA 2007-05-18 10:35:39 EDT
Created attachment 67800 [details]
Test case
Comment 5 Tomasz Zarna CLA 2007-05-18 10:37:21 EDT
Verified in I20070517-0010 with the provided test case. Michael, please release the test case too.
Comment 6 Michael Valenta CLA 2007-05-18 10:41:50 EDT
Test case released to HEAD