[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

0.9.30 and operationManager.onNotify() crash

From: lamikr <lamikr_at_cc.jyu.fi>
Date: 2005-05-05 00:18:08 CEST

Hi

I now build the subclipse from subclipse-3 branch for Linux and things
works now better with
the subversion 1.1.4. I am however still sometimes seeing some problems.

For example I can always reproduce the following crash if I delete the
manually imported core project
and fetch it again from the subclipse-3 branch by using "check out as
project" functionality. (in SVN repository perspective)
All files seems to be fetched ok, even the crash happens.

[lamikr@aragorn current]$ ./eclipse
Exception in thread "Worker-2" java.lang.NullPointerException
        at
org.tigris.subversion.subclipse.core.client.OperationManager.onNotify(OperationManager.java:134)
        at
org.tigris.subversion.svnclientadapter.SVNNotificationHandler.notifyListenersOfChange(SVNNotificationHandler.java:185)
        at
org.tigris.subversion.svnclientadapter.javahl.JhlNotificationHandler.onNotify(JhlNotificationHandler.java:207)
        at org.tigris.subversion.javahl.SVNClient.checkout(Native Method)
        at
org.tigris.subversion.javahl.SVNClientSynchronized.checkout(SVNClientSynchronized.java:231)
        at
org.tigris.subversion.svnclientadapter.javahl.JhlClientAdapter.checkout(JhlClientAdapter.java:307)
        at
org.tigris.subversion.subclipse.core.commands.CheckoutCommand.run(CheckoutCommand.java:127)
        at
org.tigris.subversion.subclipse.ui.operations.CheckoutAsProjectOperation.execute(CheckoutAsProjectOperation.java:48)
        at
org.tigris.subversion.subclipse.ui.operations.CheckoutAsProjectOperation.execute(CheckoutAsProjectOperation.java:38)
        at
org.tigris.subversion.subclipse.ui.operations.SVNOperation.run(SVNOperation.java:90)
        at
org.eclipse.team.internal.ui.actions.JobRunnableContext.run(JobRunnableContext.java:159)
        at
org.eclipse.team.internal.ui.actions.JobRunnableContext$3.runInWorkspace(JobRunnableContext.java:179)
        at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)

I checked and it happens because resource.getParent() is null in the
following line of OperationManager.java onNotify method.
      // if resource is a project. We can't refresh ../.svn
                        svnDir = resource.getParent().getFolder(new
Path(SVNConstants.SVN_DIRNAME));

public void onNotify(File path, SVNNodeKind kind) {
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IWorkspaceRoot workspaceRoot = workspace.getRoot();

        IPath pathEclipse = new Path(path.getAbsolutePath());

        if (kind == SVNNodeKind.UNKNOWN) { // delete, revert
            IPath pathEntries = pathEclipse.removeLastSegments(1).append(
                    SVNConstants.SVN_DIRNAME);
            IResource entries =
workspaceRoot.getContainerForLocation(pathEntries);
            changedResources.add(entries);
        }
        else
        {
            IResource resource = null;
            IResource svnDir = null;
            if (kind == SVNNodeKind.DIR) {
                // when the resource is a directory, two .svn
directories can
                // potentially
                // be modified
                resource =
workspaceRoot.getContainerForLocation(pathEclipse);
                if (resource != null) {
                    if (resource.getProject() != resource) {
                        // if resource is a project. We can't refresh
../.svn
                        svnDir = resource.getParent().getFolder(
                                new Path(SVNConstants.SVN_DIRNAME));
                        changedResources.add(svnDir);
                    }
                    svnDir = ((IContainer) resource).getFolder(new Path(
                            SVNConstants.SVN_DIRNAME));
                    changedResources.add(svnDir);
                }
            } else if (kind == SVNNodeKind.FILE) {
                resource = workspaceRoot.getFileForLocation(pathEclipse);

                if (resource != null) {
                    svnDir = resource.getParent().getFolder(
                            new Path(SVNConstants.SVN_DIRNAME));
                    changedResources.add(svnDir);
                }
            }
        }
    }

What it is trying to do in this code block and whether the prober fix is
simply to add nullcheck if over the execution or
or is this just a way to hide the real problem caused by some other things?

    if (resource.getParent() != null)
    {
             svnDir = resource.getParent().getFolder(
                                new Path(SVNConstants.SVN_DIRNAME));
             changedResources.add(svnDir);
    }
Received on Thu May 5 08:18:08 2005

This is an archived mail posted to the Subclipse Dev mailing list.