Login | Register
My pages Projects Community openCollabNet

Discussions > dev > [Subclipse-dev] NullPointerException - PeekStatusCommand, SwitchToUrlCommand - Errors when no installed client adapters

subclipse
Discussion topic

Hide all messages in topic

All messages in topic

RE: [Subclipse-dev] NullPointerException - PeekStatusCommand, SwitchToUrlCommand - Errors when no installed client adapters

Author selsemore
Full name Stephen Elsemore
Date 2012-04-19 13:58:58 PDT
Message Thanks, Chad. Fixed this:

http://subclipse.tig​ris.org/issues/show_​bug.cgi?id=1408

[Subclipse-dev] NullPointerException - PeekStatusCommand, SwitchToUrlCommand - Errors when no installed client adapters

Author Chad Nouis <chad dot nouis at gmail dot com>
Full name Chad Nouis <chad dot nouis at gmail dot com>
Date 2012-04-19 12:02:33 PDT
Message Hi, I encounter a NullPointerException when trying to share an existing Eclipse project in an environment where the required Subclipse plugins have been installed, but not specific client adapters such as JavaHL or SVNKit. My environment: os.arch=x86 os.name=Windows 7 java.runtime.version=1.7.0-b147 osgi.framework.version=3.7.2.v20120110-1415 org.tigris.subversion.clientadapter.feature (1.8.2) "Subversion Client Adapter" org.tigris.subversion.subclipse (1.8.8) "SVN Team Provider Core" org.tigris.subversion.clientadapter (1.8.2) "Subversion Client Adapter" [Active] org.tigris.subversion.subclipse.core (1.8.8) "SVN Team Provider Core" [Active] org.tigris.subversion.subclipse.doc (1.3.0) "Subclipse Documentation" [Resolved] org.tigris.subversion.subclipse.tools.usage (1.1.0) "Subclipse Usage Reporting" [Active] org.tigris.subversion.subclipse.ui (1.8.8) "SVN Team Provider UI" [Active] Note: No client adapters such as SVNKit have been installed. I can confirm that installing the SVNKit Client Adapter avoids the exceptions. Reproduction recipe: * In a fresh copy of Eclipse, install only the Subclipse and Subversion Client Adapter plugins. * In Eclipse, make sure the Package Explorer view is showing. Window => Show View => Package Explorer. * Right-click an open project in the Package Explorer view. * Highlight Team. * Click Share Project.... * Click SVN. Simply clicking the SVN label will pop-up a dialog box titled Problem Occurred. Clicking Details provides the following: An error has occurred. See error log for more details. java.lang.NullPointerException The following appears in the .metadata/.log file: !ENTRY org.eclipse.jface 4 2 2012-04-19 14:29:32.772 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface". !STACK 0 java.lang.NullPointerException at org.tigris.subversion.subclipse.core.client.PeekStatusCommand.execute(PeekStatusCommand.java:91) at org.tigris.subversion.subclipse.core.resources.SVNWorkspaceRoot.peekResourceStatusFor(SVNWorkspaceRoot.java:308) at org.tigris.subversion.subclipse.ui.wizards.sharing.SharingWizard.doesSVNDirectoryExist(SharingWizard.java:491) at org.tigris.subversion.subclipse.ui.wizards.sharing.SharingWizard.addPages(SharingWizard.java:111) at org.eclipse.team.internal.ui.wizards.ConfigureProjectWizardMainPage$1.selectionChanged(ConfigureProjectWizardMainPage.java:148) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211) at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1241) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:239) at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:233) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:403) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard.openWizard(ConfigureProjectWizard.java:224) at org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard.shareProjects(ConfigureProjectWizard.java:124) at org.eclipse.team.internal.ui.actions.ConfigureProjectAction$1.run(ConfigureProjectAction.java:39) at org.eclipse.team.internal.ui.actions.TeamAction$3.run(TeamAction.java:266) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:263) at org.eclipse.team.internal.ui.actions.ConfigureProjectAction.execute(ConfigureProjectAction.java:33) at org.eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:515) at org.eclipse.team.internal.ui.actions.TeamAction.runWithEvent(TeamAction.java:549) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) Possible cause: // line 91 of PeekStatusCommand.java: client.removeNotifyListener( revisionListener ); client can be null if an exception is thrown during any of the following calls: // line 68 of PeekStatusCommand.java: client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient(); In debugging, I have tracked the following code path: * PeekStatusCommand.execute calls SVNClientManager.getSVNClient * SVNClientManager.getSVNClient calls SVNClientManager.getAdapter * All attempts to set the client variable in SVNClientManager.getAdapter fail * SVNClientManager.getAdapter throws an SVNException * Control jumps to the finally block in PeekStatusCommand.execute * A NullPointerException occurs because the client variable is null I have found that org.tigris.subversion.subclipse.core.client.SwitchToUrlCommand exhibits the same problem: ISVNClientAdapter svnClient = null; try { // snip svnClient = root.getRepository().getSVNClient(); // snip } finally { // snip if (conflictResolver != null) { svnClient.addConflictResolutionCallback(null); } // snip } Possible resolution: I believe the problems can be resolved in either of two ways: * Move the beginning of the try blocks to after the retrieval of the ISVNClientAdapter. * Check the ISVNClientAdapter variables aren't null before using them in the finally blocks. While a user who hasn't installed a client adapter will still receive an exception when clicking on the SVN label, I believe the SVNException with a message of "Unable to load default SVN Client" will be more useful than a NullPointerException. Thanks, Chad Nouis
Messages per page: