This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 34743 - NPE on JTextFieldOperator.typeText()
Summary: NPE on JTextFieldOperator.typeText()
Status: CLOSED WONTFIX
Alias: None
Product: qa
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P3 blocker (vote)
Assignee: issues@qa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-03 13:06 UTC by sva
Modified: 2011-02-17 09:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
TestFile (3.19 KB, text/plain)
2003-07-08 18:00 UTC, sva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sva 2003-07-03 13:06:48 UTC
Steps to reproduce:
1. call typeText() function in JTextFieldOperator class.

Result: NPE occur
java.lang.NullPointerException
	at org.netbeans.jemmy.ClassReference.<init>
(ClassReference.java:43)
	at org.netbeans.jemmy.EventDispatcher.<init>
(EventDispatcher.java:83)
	at 
org.netbeans.jemmy.operators.ComponentOperator.<init>
(ComponentOperator.java:177)
	at 
org.netbeans.jemmy.operators.ContainerOperator.<init>
(ContainerOperator.java:65)
	at 
org.netbeans.jemmy.operators.WindowOperator.<init>
(WindowOperator.java:68)
	at 
org.netbeans.jemmy.util.DefaultVisualizer.makeVisible
(DefaultVisualizer.java:195)
	at 
org.netbeans.jemmy.operators.ComponentOperator.makeComponent
Visible(ComponentOperator.java:793)
	at 
org.netbeans.jemmy.operators.JTextComponentOperator.typeText
(JTextComponentOperator.java:512)
	at 
org.netbeans.jemmy.operators.JTextComponentOperator.typeText
(JTextComponentOperator.java:534)
	at 
org.netbeans.web.test.util.Utils.fillAddBreakpointException
(Unknown Source)
	at 
org.netbeans.test.gui.web.JSPServletDebug.JavaDebugging.test
StopsOnExceptionCaughtBreakpoint(JavaDebugging.java:168)
	at sun.reflect.NativeMethodAccessorImpl.invoke0
(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest
(TestCase.java:154)
	at junit.framework.TestCase.runBare
(TestCase.java:127)
	at org.netbeans.jellytools.JellyTestCase.runBare
(JellyTestCase.java:108)
	at junit.framework.TestResult$1.protect
(TestResult.java:106)
	at junit.framework.TestResult.runProtected
(TestResult.java:124)
	at junit.framework.TestResult.run
(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.netbeans.junit.NbTestCase.run
(NbTestCase.java:85)
	at junit.framework.TestSuite.runTest
(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at 
org.netbeans.xtest.testrunner.JUnitTestRunner.runTests
(JUnitTestRunner.java:159)
	at 
org.netbeans.xtest.testrunner.JUnitTestRunnerExecutor.execut
eInIDE(JUnitTestRunnerExecutor.java:100)
	at 
org.netbeans.xtest.testrunner.JUnitTestRunnerExecutor.execut
eTestRun(JUnitTestRunnerExecutor.java:168)
	at 
org.netbeans.xtest.testrunner.JUnitTestRunnerExecutor.main
(JUnitTestRunnerExecutor.java:219)
	at sun.reflect.NativeMethodAccessorImpl.invoke0
(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.openide.execution.ThreadExecutor.executeClass
(ThreadExecutor.java:116)
	at 
org.openide.execution.ThreadExecutor$TERunnable.run
(ThreadExecutor.java:183)
	at org.netbeans.core.execution.RunClassThread.run
(RunClassThread.java:120)


I've run tests from /cvs/web/test/JSPServletDebug directory
Example of code you can find 
in /cvs/web/test/Common/src/org/netbeans/web/test/util/Utils
.java (fillAddBreakpointMethod function)

Reproduced with nightly build on Solaris 9.
Comment 1 Jiri Skrivanek 2003-07-04 09:07:21 UTC
Following code works for me:

        String workDir = "sampledir";
        EditorOperator editor = Utils.openFile(workDir, "jsp3");
        JSPNode jspNode = new JSPNode(workDir+"|jsp3");
        jspNode.viewServlet();
        EditorWindowOperator editorWindow = new
EditorWindowOperator("Servlet for jsp3");
        editor = editorWindow.selectPage("Servlet for jsp3");
        editor.setCaretPositionToLine(56);
        (new AddBreakpointAction()).performMenu(); 
        Utils.fillAddBreakpointException(null,
"IndexOutOfBoundsException", 0);

So far, I tested it on WinXP and Solaris8 (Gnome) in build
200307040100, JDK1.4.1_01.
Could you send description of your environment and screen shot if
available?

Comment 2 sva 2003-07-08 17:59:34 UTC
My configuration is:
Solaris Sparc 9, jdk 1.4.1_02. , CDE
I've create new test (in attachment), run it, and have NPE 
(1st my comment).
Exception appear in method fillAddBreakpointException on 
line "exceptionField.typeText(exceptionName);"
I've try another window manager but the result is the same.

Comment 3 sva 2003-07-08 18:00:11 UTC
Created attachment 10890 [details]
TestFile
Comment 4 Jiri Skrivanek 2003-07-09 13:16:52 UTC
OK, I am able to reproduce and know why it happens. So what your test
does is the following:

- open New Breakpoint dialog
- find Breakpoint Type combo box and call setSelectedItem("Exception")
- find second JTextField in the dialog

But JTextFiled found by jemmy is the one for Line Breakpoint Type
because dialog was not refreshed in time. Then typing a text in non
existing text field throws NPE.
So, I strongly recommend to use selectItem() method instead of
setSelectedItem(). It waits until item is really selected and it
should satisfy that the dialog is already refreshed. I tested it and
it worked for me well.
Comment 5 sva 2003-07-09 13:43:21 UTC
Closed.