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

Re: [Subclipse-users] 0.9.102: NPE on commit with new resources

From: Holger Hoffstaette <holger_at_wizards.de>
Date: 2005-12-27 17:07:23 CET

On Tue, 27 Dec 2005 09:13:14 -0500, Mark Phippard wrote:

> I can't reproduce this. Can you give any more details? I have tried
> having an unversioned folder, a file and a file and a folder. I have
> tried it with and without modified files in the same commit. I have tried
> it with JavaHL and JavaSVN. In all cases it works correctly.

I just tried again in another checked-out project.

- add new class in any package
- select new file in package explorer
- select Team->Commit
- check box of unversioned file
- press OK button -> nothing happens
- the error log contains the NPE (full stack trace below).

That's all I did. Previous versions of subclipse worked fine. I use the
JavaHL backend.

> Any ideas as to what would be different? Is your stack trace always the
> same? The error you gave before lines up with this bit of code:
>
> for (int i = 0; i < selectedResources.length; i++) {
>
> selectedResources are the items in the dialog that are checked. I tested
> the case where you didn't select anything. In that case I got a
> zero-length array, not a null, so even then it didn't error out.

Well without having looked at the source I can't say for sure but the
reason is obviously a stray code path were the array does not get
initialized properly. Solutions:

- initialize the array on declaration with an empty array
- never set arrays or collections to null - only empty arrays or
Collections.EMPTY_LIST

I cannot remember the last time I had an NPE, and I do JNI myself.. :)

thanks for looking,
Holger

-- snip --

java.lang.NullPointerException
at org.tigris.subversion.subclipse.ui.dialogs.CommitDialog.checkForUnselectedPropChangeChildren(CommitDialog.java:232)
at org.tigris.subversion.subclipse.ui.dialogs.CommitDialog.okPressed(CommitDialog.java:225)
at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:409)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
at org.eclipse.jface.window.Window.open(Window.java:787)
at org.tigris.subversion.subclipse.ui.actions.CommitAction.confirmCommit(CommitAction.java:169)
at org.tigris.subversion.subclipse.ui.actions.CommitAction$1.run(CommitAction.java:81)
at org.tigris.subversion.subclipse.ui.repository.RepositoryManager.run(RepositoryManager.java:373)
at org.tigris.subversion.subclipse.ui.actions.SVNAction$1.run(SVNAction.java:228)
at org.tigris.subversion.subclipse.ui.actions.SVNAction$2.run(SVNAction.java:237)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.tigris.subversion.subclipse.ui.actions.SVNAction.run(SVNAction.java:234)
at org.tigris.subversion.subclipse.ui.actions.CommitAction.execute(CommitAction.java:69)
at org.tigris.subversion.subclipse.ui.actions.SVNAction.run(SVNAction.java:58)
at org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDelegate.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:236)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)

-- snip --
Received on Wed Dec 28 03:07:23 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.