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 120749 - javax.swing.text.BadLocationException when creating any project
Summary: javax.swing.text.BadLocationException when creating any project
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P1 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2007-11-01 01:05 UTC by _ potingwu
Modified: 2007-11-05 13:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Log file for creating a simple Java project. (I'm using JDK 6, same issue for JDK 5 as well) (30.87 KB, text/plain)
2007-11-01 01:08 UTC, _ potingwu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ potingwu 2007-11-01 01:05:55 UTC
I just update my workspace (even also try a clean cvs), I now can't create any project. I got,
SEVERE [global]
javax.swing.text.BadLocationException: Invalid offset=363, docLength=342
...

And all Java/JSP files created are empty! It happened when creating a simple Java project or Web project as I tried.
Comment 1 _ potingwu 2007-11-01 01:08:15 UTC
Created attachment 52206 [details]
Log file for creating a simple Java project. (I'm using JDK 6, same issue for JDK 5 as well)
Comment 2 Vitezslav Stejskal 2007-11-01 09:44:06 UTC
Probably related to turning on formatting of newly created files. Milo, could you please look into it. Thanks
Comment 3 Miloslav Metelka 2007-11-01 11:25:17 UTC
Caused by fix of issue 101720. I will fix it.
Comment 4 Miloslav Metelka 2007-11-01 11:26:03 UTC
Oops, I wanted to mark as started :(
Comment 5 Miloslav Metelka 2007-11-01 15:54:29 UTC
I guess that this is OS dependent since I cannot reproduce the problem on Linux. The problem is likely caused by the
templates on Windows having CRLF line separator which gets shrinked to LF for the document insertion. The code assumed
that the inserted text's length will match the characters in the document. Should be fixed please reopen if the problem
persists. Thanks.

Checking in FormatterWriterImpl.java;
/cvs/editor/indent/src/org/netbeans/modules/editor/indent/FormatterWriterImpl.java,v  <--  FormatterWriterImpl.java
new revision: 1.3; previous revision: 1.2
Comment 6 Marian Mirilovic 2007-11-02 10:45:56 UTC
potingwu, 
could you please verify this issue ? Thanks in advance.
Comment 7 Jan Lahoda 2007-11-02 14:04:06 UTC
For the record: fix for issue #101720 has been rolled back, as well as fix for this issue.
Comment 8 _ ttran 2007-11-02 17:24:26 UTC
in this case we have to REOPEN this bug
Comment 9 _ potingwu 2007-11-02 19:37:46 UTC
I just updated my workspace and it's working.
Comment 10 Vitezslav Stejskal 2007-11-02 20:20:55 UTC
I don't think this should be reopened. The fix for issue #101720 caused the regression reported here; reverting the
changes made for #101720 means that the culprit of this regression is gone too. So, we are back to square one and all
should work as before, which potingwu seems to confirm. Thanks guys!
Comment 11 _ ttran 2007-11-02 22:00:26 UTC
that's good.  I just didn't understand jlahoda's comment.  Thx