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 252378 - NullPointerException at javax.swing.text.JTextComponent.getCaretPosition
Summary: NullPointerException at javax.swing.text.JTextComponent.getCaretPosition
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-13 12:11 UTC by cezariusz
Modified: 2015-09-10 01:29 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 217274


Attachments
stacktrace (5.96 KB, text/plain)
2015-05-13 12:11 UTC, cezariusz
Details
stacktrace (5.96 KB, text/plain)
2015-05-15 10:11 UTC, Maksim Khramov
Details
stacktrace (3.83 KB, text/plain)
2015-06-15 10:49 UTC, Ralph Ruijs
Details
stacktrace (3.83 KB, text/plain)
2015-06-19 16:01 UTC, _ gtzabari
Details
stacktrace (2.05 KB, text/plain)
2015-06-21 18:04 UTC, Lolmewn
Details
stacktrace (3.73 KB, text/plain)
2015-07-15 08:47 UTC, Alexandr Scherbatiy
Details
stacktrace (3.73 KB, text/plain)
2015-08-04 02:33 UTC, David Konecny
Details
stacktrace (4.83 KB, text/plain)
2015-08-07 09:53 UTC, bolsover
Details
stacktrace (6.02 KB, text/plain)
2015-09-08 23:22 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cezariusz 2015-05-13 12:11:01 UTC
Build: NetBeans IDE Dev (Build 201505130001)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.45-b02, Java(TM) SE Runtime Environment, 1.8.0_45-b14
OS: Windows 7

User Comments:
cezariusz: Closed a platform source file, after playing with collapse/expand.




Stacktrace: 
java.lang.NullPointerException
   at javax.swing.text.JTextComponent.getCaretPosition(JTextComponent.java:1644)
   at org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory$ChangeListenerImpl.stateChanged(CaretAwareJavaSourceTaskFactory.java:187)
   at org.netbeans.api.java.source.support.OpenedEditors.fireChangeEvent(OpenedEditors.java:121)
   at org.netbeans.api.java.source.support.OpenedEditors.stateChanged(OpenedEditors.java:177)
   at org.netbeans.api.java.source.support.OpenedEditors$1.propertyChange(OpenedEditors.java:91)
   at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
Comment 1 cezariusz 2015-05-13 12:11:03 UTC
Created attachment 153629 [details]
stacktrace
Comment 2 Maksim Khramov 2015-05-15 10:11:49 UTC
Created attachment 153681 [details]
stacktrace

Edit java code. 
Set caret somewhere in text then scroll code down, so caret is goes beyond visible part.
Close Editor
Comment 3 Ralph Ruijs 2015-06-15 10:49:24 UTC
Created attachment 154224 [details]
stacktrace

Closed a bunch of tabs by repeatedly pressing ctrl+w
Comment 4 Exceptions Reporter 2015-06-15 10:49:31 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=217274
Comment 5 _ gtzabari 2015-06-19 16:01:39 UTC
Created attachment 154303 [details]
stacktrace

Closed last editor tab. Exception thrown.
Comment 6 Lolmewn 2015-06-21 18:04:43 UTC
Created attachment 154318 [details]
stacktrace

Closed last open code window
Comment 7 Alexandr Scherbatiy 2015-07-15 08:47:28 UTC
Created attachment 154643 [details]
stacktrace

Edit source code
Comment 8 David Konecny 2015-08-04 02:33:21 UTC
Created attachment 155156 [details]
stacktrace

closed all open editors
Comment 9 Exceptions Reporter 2015-08-04 02:33:28 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=217274
Comment 10 bolsover 2015-08-07 09:53:05 UTC
Created attachment 155213 [details]
stacktrace

Closing GUI design window
Comment 11 Alexandr Scherbatiy 2015-08-25 06:56:08 UTC
It seems that JTextField.caret is null for some reasons during JTextComponent.getCaretPosition() call:

---------------
        //TODO: are we in AWT Thread?:
        setLastPosition(OpenedEditors.getFileObject(c), c.getCaretPosition());
---------------
Comment 12 MackSix 2015-09-08 23:22:03 UTC
Created attachment 155988 [details]
stacktrace

Closing some java source files open in the Editor by clicking on the x on the document tabs.
Comment 13 Miloslav Metelka 2015-09-09 11:22:42 UTC
Fixed.
http://hg.netbeans.org/jet-main/rev/08fe68440e4d
Comment 14 Quality Engineering 2015-09-10 01:29:25 UTC
Integrated into 'main-silver', will be available in build *201509100002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/08fe68440e4d
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #252378 - NullPointerException at javax.swing.text.JTextComponent.getCaretPosition.