Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359543

Summary: [Sync view][Apply patch] NPE in PatchModelProvider#getFile
Product: [Eclipse Project] Platform Reporter: Nicolas Bros <nicolas.bros>
Component: TeamAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: malgorzata.tomczyk, Szymon.Brandys, tomasz.zarna
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
stacktrace none

Description Nicolas Bros CLA 2011-09-30 06:33:16 EDT
Created attachment 204367 [details]
stacktrace

I got a NPE when modifying files in my workspace after I tried to apply a patch from my clipboard with the synchronize view.

see attached stacktrace

version : M20110909-1335
Comment 1 Tomasz Zarna CLA 2011-09-30 07:13:30 EDT
(In reply to comment #0)
> after I tried to apply a patch from my clipboard with the synchronize view.

A set of reproducible steps would be great or can I assume you did what you described in bug 359549 comment 0?
Comment 2 Nicolas Bros CLA 2011-09-30 08:15:17 EDT
(In reply to comment #1)
> A set of reproducible steps would be great or can I assume you did what you
> described in bug 359549 comment 0?

Yes, I was trying to apply this patch, first by copy-pasting directly in the Package Explorer, and then with the Synchronize view because there were merge conflicts.

The error happened when I reverted a file that was part of the patch in my workspace (from the Package Explorer).

Judging by the stack trace, I guess the PatchModelProvider#getFile failure happened because I did not provide a patch file as I went through the clipboard instead.
Comment 3 Tomasz Zarna CLA 2011-10-04 09:06:21 EDT
Gosia, could you please look at it? Check first if a similar problem hasn't been already reported (hint: "[Sync View][Apply Patch]" in summary).
Comment 4 Malgorzata Janczarska CLA 2011-11-14 12:06:49 EST
I managed to reproduce this bug but not with steps in bug 359549.
I managed to reproduce the bug only when applying the patch to the workspace root. Pointing the project to which patch is supposed to be applied resulted in displaying the content and no NPE.

Nicolas, did your patch contain project markers: "#P <project.name>"?
If no did you choose to apply your patch to the workspace root?
Comment 5 Nicolas Bros CLA 2011-11-15 03:00:17 EST
(In reply to comment #4)
> Nicolas, did your patch contain project markers: "#P <project.name>"?
Yes, I always create "workspace" patches. I believe the patch I was trying to apply was the one from Bug 359549.
Comment 6 Malgorzata Janczarska CLA 2011-11-15 03:46:51 EST
(In reply to comment #5)
> (In reply to comment #4)
> > Nicolas, did your patch contain project markers: "#P <project.name>"?
> Yes, I always create "workspace" patches. I believe the patch I was trying to
> apply was the one from Bug 359549.

Could you try again with it? I used patch for Bug 359549 recently and it doesn't cause NPE. This patch has the project markers ("#P <project.name>"). I get NPE only when I apply patch that doesn't have project markers and is applied to workspace root.
Comment 7 Nicolas Bros CLA 2011-11-15 04:10:01 EST
(In reply to comment #6)
> Could you try again with it? I used patch for Bug 359549 recently and it
> doesn't cause NPE. This patch has the project markers ("#P <project.name>").
You are right, I don't see the NPE anymore.

(In reply to comment #6)
> I get NPE only when I apply patch that doesn't have project markers and is
> applied to workspace root.
When I do this, Eclipse applies the patch anyway and creates a project named "src".
Comment 8 Malgorzata Janczarska CLA 2014-09-12 08:10:02 EDT
In last comment it looks like the bug is no longer reproducible.