Re: Problems with auto-sharing in 1.10.3 NPE

Stephen Elsemore <[email protected]> Fri, 21 Feb 2014 06:44:07 -0800
Newsgroups gmane.comp.version-control.subversion.subclipse.user
Message-ID <CANtm4Ev-TbUPVQG4_xhq2J9Y_us-cf2shydQNaOtzoJpWyHh7A@mail.gmail.com>
I found this difficult to recreate even using debug, but your proposed fix
is simple enough and I've confirmed that it doesn't cause any problem, so
I've committed it.  Thanks.

On Wed, Feb 19, 2014 at 8:33 AM, Jan Arciuchiewicz <[email protected]>wrote:

>  We are having problems with auto-sharing option (introduced probably in
> 1.10). In our product on first start (on a new workspace) we create a
> hidden project with diagram fragments. During this process we create and
> remove a temporary  project.
>
>
>
> The AutoShareJob is notified of a new project by adding the project to
> internal "work list"  of project to share. Then projects are popped form
> that list and passed to be processed when the job is being run
> (SVNTeamProviderType.AutoShareJob.run()).
>
>
>
> Unfortunately in our case the project is gone by then and
> autoconnectSVNProject is not checking if the project is still accessible.
> This lead to the NPE in line 75 of PeekStatusCommand because
> resource.getLocation() returns 'null'.
>
> ...
>
> *if* (*this*.resource != *null*)
>
>         file = *this*.resource.getLocation().toFile();
>
> ...
>
> java.lang.NullPointerException
>
>                 at
> org.tigris.subversion.subclipse.core.client.PeekStatusCommand.execute(PeekStatusCommand.java:75)
>
>                 at
> org.tigris.subversion.subclipse.core.SVNTeamProviderType$AutoShareJob.autoconnectSVNProject(SVNTeamProviderType.java:129)
>
>                 at
> org.tigris.subversion.subclipse.core.SVNTeamProviderType$AutoShareJob.run(SVNTeamProviderType.java:105)
>
>                 at
> org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
>
> It's not a typical use case but you users could run to this problem (with
> poping up NPE) if they or tools create and immediately delete a project in
> a background job.
>
> One of possible  fix could be to check if the project to share is still
> accessible when this job runs.
>
>       *while* (next != *null*) {
>
>
>
>                 if (next.isAccessible()) {
>
>          *autoconnectSVNProject*(next, Policy.subMonitorFor(monitor, -1));
>
> }
>
>
>
>         next = getNextProject();
>
>       }
>
> Thanks, Jan
>

------------------------------------------------------
http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1047&dsMessageId=3073359

To unsubscribe from this discussion, e-mail: [[email protected]].