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 245776 - javax.swing.text.BadLocationException: Invalid offset=8571 > (docLen+1)=8453
Summary: javax.swing.text.BadLocationException: Invalid offset=8571 > (docLen+1)=8453
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.1
Hardware: All All
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-18 02:01 UTC by MackSix
Modified: 2015-06-24 02:26 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 210732


Attachments
stacktrace (4.52 KB, text/plain)
2014-07-18 02:01 UTC, MackSix
Details
stacktrace (4.52 KB, text/plain)
2014-07-18 02:13 UTC, MackSix
Details
stacktrace (7.10 KB, text/plain)
2014-07-18 15:58 UTC, MackSix
Details
Zipped log file directory (414.45 KB, application/x-zip-compressed)
2014-07-18 16:03 UTC, MackSix
Details
stacktrace (4.99 KB, text/plain)
2014-07-30 08:01 UTC, Exceptions Reporter
Details
stacktrace (4.99 KB, text/plain)
2014-10-01 14:17 UTC, stefan79
Details
stacktrace (4.99 KB, text/plain)
2014-10-13 12:12 UTC, stefan79
Details
stacktrace (4.99 KB, text/plain)
2014-10-15 14:31 UTC, stefan79
Details
stacktrace (5.59 KB, text/plain)
2015-04-07 09:21 UTC, markiewb
Details
File for reproduction (1.31 KB, application/octet-stream)
2015-04-07 09:59 UTC, markiewb
Details
stacktrace (2.89 KB, text/plain)
2015-05-16 08:20 UTC, akobberup
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2014-07-18 02:01:38 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-1921-on-20140717)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.11-b03, Java(TM) SE Runtime Environment, 1.8.0_11-b12
OS: Windows 7

User Comments:
MackSix: Running Inspect & Transform on Apache Commons Collection 4 (commons-collections4-4.0-src.zip) http://commons.apache.org/proper/commons-collections/download_collections.cgi

GUEST: changing sourcefiles from another program

GUEST: .




Stacktrace: 
javax.swing.text.BadLocationException: Invalid offset=8571 > (docLen+1)=8453
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkOffsetInContent(EditorDocumentContent.java:286)
   at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.createPosition(EditorDocumentContent.java:198)
   at javax.swing.text.AbstractDocument.createPosition(AbstractDocument.java:829)
   at org.netbeans.modules.editor.indent.TaskHandler.setCaretOffset(TaskHandler.java:129)
   at org.netbeans.modules.editor.indent.IndentImpl.reindent(IndentImpl.java:259)
   at org.netbeans.modules.editor.indent.api.Indent.reindent(Indent.java:171)
Comment 1 MackSix 2014-07-18 02:01:39 UTC
Created attachment 148123 [details]
stacktrace
Comment 2 MackSix 2014-07-18 02:13:24 UTC
Created attachment 148124 [details]
stacktrace

Repeatable
Comment 3 MackSix 2014-07-18 15:58:26 UTC
Created attachment 148141 [details]
stacktrace

Running the first 11 Inspect & Transform Analyzers on Apache Commons Collection 4 source code. http://commons.apache.org/proper/commons-collections/download_collections.cgi
Comment 4 Exceptions Reporter 2014-07-18 15:58:30 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=210732
Comment 5 MackSix 2014-07-18 16:02:59 UTC
There is a bunch of dump files in the log directory and the log file is full of source code. See attached zip file with the log file directory.
Comment 6 MackSix 2014-07-18 16:03:50 UTC
Created attachment 148142 [details]
Zipped log file directory
Comment 7 markiewb 2014-07-21 08:11:20 UTC
I encountered that exception several times using the new dev build 201407200001

javax.swing.text.BadLocationException: Invalid offset=104335 > (docLen+1)=103675
	at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.checkOffsetInContent(EditorDocumentContent.java:286)
	at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.createPosition(EditorDocumentContent.java:198)
	at javax.swing.text.AbstractDocument.createPosition(AbstractDocument.java:829)
	at org.netbeans.modules.editor.indent.TaskHandler.setCaretOffset(TaskHandler.java:129)
	at org.netbeans.modules.editor.indent.IndentImpl.reindent(IndentImpl.java:259)
	at org.netbeans.modules.editor.indent.api.Indent.reindent(Indent.java:171)
[catch] at org.netbeans.modules.java.source.save.CasualDiff$1.run(CasualDiff.java:386)
	at org.netbeans.editor.BaseDocument.runAtomicAsUser(BaseDocument.java:1416)
	at org.netbeans.editor.BaseDocument.runAtomic(BaseDocument.java:1405)
	at org.netbeans.modules.java.source.save.CasualDiff.diff(CasualDiff.java:382)
	at org.netbeans.api.java.source.WorkingCopy.processCurrentCompilationUnit(WorkingCopy.java:849)
	at org.netbeans.api.java.source.WorkingCopy.getChanges(WorkingCopy.java:1170)
	at org.netbeans.api.java.source.ModificationResult$1.run(ModificationResult.java:155)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:598)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:155)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:139)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:206)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:203)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:74)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:203)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:106)
	at org.netbeans.api.java.source.ModificationResult.runModificationTask(ModificationResult.java:137)
	at org.netbeans.modules.java.hints.OrganizeMembers.checkMembers(OrganizeMembers.java:109)
	at sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.netbeans.modules.java.hints.providers.code.CodeHintProviderImpl$WorkerImpl.createErrors(CodeHintProviderImpl.java:336)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.runHint(HintsInvoker.java:790)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.access$400(HintsInvoker.java:111)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.runAndAdd(HintsInvoker.java:657)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.scan(HintsInvoker.java:676)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.scan(HintsInvoker.java:614)
	at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
	at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:103)
	at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99)
	at com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:120)
	at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:551)
	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:50)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker$ScannerImpl.scan(HintsInvoker.java:701)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHintsImpl(HintsInvoker.java:256)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:239)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:209)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:182)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:149)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:114)
	at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:83)
	at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:298)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:573)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:744)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)


Product Version: NetBeans IDE Dev (Build 201407200001)
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
Comment 8 markiewb 2014-07-21 08:20:54 UTC
BTW: Very annoying. It happens even at a small change in the java editor.
It also happens usign 201407090001
Comment 9 markiewb 2014-07-21 08:28:41 UTC
@mmetelka: See your mail inbox. I send you a file, which may reproduce this issue.
Comment 10 Miloslav Metelka 2014-07-21 08:40:02 UTC
It's likely java related - reassigning to java/editor (@markiewb I'll forward the file too).
Comment 11 Exceptions Reporter 2014-07-30 08:01:45 UTC
Created attachment 148400 [details]
stacktrace

.
Comment 12 stefan79 2014-10-01 14:17:14 UTC
Created attachment 149654 [details]
stacktrace

Exception occured after/while Updating Files vom cvs or while java-editing.
Comment 13 stefan79 2014-10-13 12:12:59 UTC
Created attachment 149866 [details]
stacktrace

....
Comment 14 stefan79 2014-10-15 14:31:11 UTC
Created attachment 149920 [details]
stacktrace

Inserted code in a java-file with crtl-v.
Comment 15 markiewb 2015-04-07 09:21:24 UTC
Created attachment 153073 [details]
stacktrace

Opening java files
Comment 16 markiewb 2015-04-07 09:41:52 UTC
Still happens in the newest build

Product Version: NetBeans IDE Dev (Build 201504070001)
Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE
Comment 17 markiewb 2015-04-07 09:59:35 UTC
Created attachment 153077 [details]
File for reproduction

Here a file for reproduction. It happens every time I switch to this file and set the caret. (FYI File does not compile - I removed sensitive information)
Comment 18 akobberup 2015-05-16 08:20:50 UTC
Created attachment 153700 [details]
stacktrace

Formatted a class..Invoked organize members,,
Comment 19 MackSix 2015-06-05 20:20:39 UTC
93 exception reporter duplicates--at least P2.
Comment 20 Dusan Balek 2015-06-22 15:54:49 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/644450a24495
Comment 21 Quality Engineering 2015-06-24 02:26:46 UTC
Integrated into 'main-silver', will be available in build *201506240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/644450a24495
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #245776 - javax.swing.text.BadLocationException: Invalid offset - fixed.