DESCRIPTION

Fix NPE in ResourceUtil.isSharedWithGit()

Bug: 494356
Change-Id: I005c765b2d116c4f6c6b00c9cc2121a1c0cd6fef
Signed-off-by: Douglas Trujillo xxx@xxx.xxx

COMMENTS

author: Douglas Trujillo
date: 2016-05-23 22:13:23.000000000

Uploaded patch set 1.

-------------------------------------
author: Alayna Houston
date: 2016-05-23 22:47:11.000000000

Patch Set 1:

(1 comment)

Line:104, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProvider.java -> Why is there a GitProvider with a null project? That shouldn't happen.

Is this because org.eclipse.team.core.RepositoryProvider.mapNewProvider() sets the session property before setting the project on the provider? If that's the root cause, shouldn't it be fixed there, too? (We'd still have to fix it here, to cater to older Eclipses...)

Somehow my Eclipse doesn't even show a null warning here, even though the argument xxx@xxx.xxx and getProject() is not null-annotated.

-------------------------------------
author: Brenden Conley
date: 2016-05-23 23:04:30.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/8624/

-------------------------------------
author: Brenden Conley
date: 2016-05-23 23:28:26.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/8624/ : SUCCESS

-------------------------------------
author: Douglas Trujillo
date: 2016-05-24 09:51:33.000000000

Patch Set 1:

(1 comment)

Line:104, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProvider.java -> maybe that's fallout from https://bugs.eclipse.org/bugs/show_bug.cgi?id=492048 ? Only users which are using nightly build have the fix for this problem.

I think null analysis in Eclipse is still limited

-------------------------------------
author: Alayna Houston
date: 2016-05-24 13:52:47.000000000

Patch Set 1: Code-Review+2

(1 comment)

BTW, +2.

Line:104, org.eclipse.egit.core/src/org/eclipse/egit/core/GitProvider.java -> Somehow I doubt that. The large majority of reports for bug 494356 are from EGit 4.1.0 and 4.1.1. From 4.2.0 on, there are only isolated reports on that. The submodule changes that led to bug 492048 were all part of 4.3.0. Besides in bug 492048, the whole project was unmapped, so one shouldn't get any provider anymore.

The main change in 4.2.0 in this area was https://git.eclipse.org/r/#/c/64620/ which drastically reduced the number of accesses to the persistent property, which may explain the drop in the number of reports. Doesn't mean the underlying cause was fixed by that change, though.

In 4.3.0, we also had https://git.eclipse.org/r/#/c/68729/ .

So I see two possible causes of this:
* perhaps we don't clean up properly our own session properties introduced in https://git.eclipse.org/r/#/c/64620/. Should probably add something to explicitly remove the session properties when a project is unmapped.
* or the race condition in org.eclipse.team.core.RepositoryProvider.mapNewProvider(): it makes the provider accessible through the session property before setting the project on the provider, so unless I'm missing something there's a small window during which one might get a RepositoryProvider without project.

-------------------------------------
author: Douglas Trujillo
date: 2016-05-24 14:31:10.000000000

Patch Set 1:

> (1 comment)
 > 
 > BTW, +2.
yes, it looks like we should remove our session properties when unmapping

other than persistent properties session properties seem not to be really thread-safe, setSessionProperty() is synchronised but getSessionProperty() is not

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-05-24 14:31:16.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
author: Alayna Houston
date: 2016-05-29 11:06:40.000000000

Patch Set 1:

> yes, it looks like we should remove our session properties when
 > unmapping

See https://git.eclipse.org/r/#/c/73874/ .

-------------------------------------
