Bug 8611 - NPE in text search with Compare to a Version editor open
Summary: NPE in text search with Compare to a Version editor open
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M3   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-28 13:34 EST by Ian Petersen CLA
Modified: 2002-01-30 10:17 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Petersen CLA 2002-01-28 13:34:55 EST
Build: 20020125

Description:
Doing a text search on "Selected Resource" causes a NullPointerException if the 
active editor is a comparison editor.

Steps:
1.  Right click on a java file in the Packages view and choose Compare With > 
Version... from the context menu.
2.  Once the comparison editor opens, click on a version to make the comparison.
3.  Choose Edit > Search...
4.  In the dialog that opens, Text search should be the default tab.  If not, 
choose it.
5.  Enter some text in the search field and choose "Selected Resources" in the 
Scope frame.
6.  Click on the Search button.
7.  Here you get an error.

Stack trace from the log:
Log: Mon Jan 28 13:32:00 EST 2002
4 org.eclipse.core.runtime 0 Unhandled exception caught in event loop.
java.lang.NullPointerException
	at 
org.eclipse.search.internal.ui.text.TextSearchPage.getSelectedResourcesScope
(TextSearchPage.java:469)
	at org.eclipse.search.internal.ui.text.TextSearchPage.performAction
(TextSearchPage.java:118)
	at org.eclipse.search.internal.ui.SearchDialog.performAction
(SearchDialog.java:215)
	at 
org.eclipse.search.internal.ui.util.ExtendedDialogWindow.buttonPressed
(ExtendedDialogWindow.java:162)
	at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:344)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java
(Compiled Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled 
Code))
	at org.eclipse.jface.window.Window.open(Window.java:523)
	at org.eclipse.search.internal.ui.OpenSearchDialogAction.run
(OpenSearchDialogAction.java:45)
	at org.eclipse.search.internal.ui.OpenSearchDialogAction.run
(OpenSearchDialogAction.java:32)
	at org.eclipse.ui.internal.PluginAction.runWithEvent
(PluginAction.java:204)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:827)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:878)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:321)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.Main.main(Main.java:362)
4.  Run a text search
Comment 1 Kevin Haaland CLA 2002-01-29 11:36:22 EST
Looks like a Search/Compare issue
Comment 2 Dani Megert CLA 2002-01-30 10:17:08 EST
The history view does not provide any selection. This is valid but not very
common. I have protected the search page code against the NPE and filed another
PR against myself:

Disable "Selected Resource" in scope part if no resource
  http://dev.eclipse.org/bugs/show_bug.cgi?id=8749

Also fixes JavaSearchPage and NLSSearchPage.