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.
Build: NetBeans IDE Dev (Build 200803240003) VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06, Java(TM) SE Runtime Environment, 1.6.0_02-b06 OS: Windows XP, 5.1, x86 User comments: Was not doing anythign special, just editing code in the main NB window while editing code STACKTRACE: (first 10 lines) javax.swing.text.BadLocationException: Invalid offset=3574 not within <0, 3573> at org.netbeans.editor.Utilities.checkOffsetValid(Utilities.java:1331) at org.netbeans.editor.Utilities.getLineOffset(Utilities.java:613) at org.netbeans.modules.html.editor.gsf.HtmlStructureScanner$1.visit(HtmlStructureScanner.java:120) at org.netbeans.editor.ext.html.parser.AstNodeUtils.visitChildren(AstNodeUtils.java:90) at org.netbeans.editor.ext.html.parser.AstNodeUtils.visitChildren(AstNodeUtils.java:91) at org.netbeans.modules.html.editor.gsf.HtmlStructureScanner.folds(HtmlStructureScanner.java:131) at org.netbeans.modules.gsfret.editor.fold.GsfFoldManager$JavaElementFoldTask.addTree(GsfFoldManager.java:403) at org.netbeans.modules.gsfret.editor.fold.GsfFoldManager$JavaElementFoldTask.scan(GsfFoldManager.java:396) at org.netbeans.modules.gsfret.editor.fold.GsfFoldManager$JavaElementFoldTask.gsfFoldScan (GsfFoldManager.java:320) at org.netbeans.modules.gsfret.editor.fold.GsfFoldManager$JavaElementFoldTask.run(GsfFoldManager.java:287)
This error is perpetual. Loading existing projects or doing ANY editing at all. The IDE is totally unusable!!!!
This issue has already 5 duplicates
Build: NetBeans IDE Dev (Build 080329) VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b14 OS: Linux, 2.6.20-16-generic, i386 User Comments: Opening a JSP file.
Created attachment 59370 [details] stacktrace
Build: NetBeans IDE Dev (Build 200803302302) VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b13 OS: Linux, 2.6.24-ARCH, i386 User Comments: editing jsp file?
Created attachment 59385 [details] stacktrace
Build: NetBeans IDE Dev (Build 080330) VM: Java HotSpot(TM) Client VM, 1.6.0_03-b04, Java(TM) SE Runtime Environment, 1.6.0_03-b04 OS: Linux, 2.6.22-14-generic, i386 User Comments: Typing in javascript section of jsp attached in issue http://www.netbeans.org/issues/show_bug.cgi?id=129561
Created attachment 59414 [details] stacktrace
Build: NetBeans IDE Dev (Build 200803302302) VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06, Java(TM) SE Runtime Environment, 1.6.0_02-b06 OS: Windows XP, 5.1, x86 User Comments:
Created attachment 59438 [details] stacktrace
Right now this does reproducibly appear every time I try using code completion within a JSP file, practically rendering the JSP editor in current build (200804010004) unusable. Seems more than just a P3 to me.
Build: NetBeans IDE Dev (Build 200803311426) VM: Java HotSpot(TM) Client VM, 1.6.0_10-ea-b07, Java(TM) SE Runtime Environment, 1.6.0_10-ea-b07 OS: SunOS, 5.11, x86 User Comments: [web/jsp editor] Create new JSP file insert this code inside: -------------------------- <html> <body bgcolor="white"> <h1> I have been invoked by <% out.print(request.getAttribute("servletName").toString());%> Servlet. </h1> </body> </html> ------------- BLE is thrown
Created attachment 59507 [details] stacktrace
It looks like there a two problems in the HtmlStructureScanner. One is that the document is not readlocked during the AST visiting due to performance reasons. However I need to touch the document to find line starts/ends. If there is not html virtual translated source (editing pure html) it may happen that during the ast visiting the document is modified and then the offsets may go beyond end of the document. Second problem is the BLE for -1 position - this looks like no document position has been found for a position in virtual source. This is bad, I need to investigate it more. Anyway, I think this issue must be fixed in 6.1, priority is already P1 so just setting milestone to dev. I try to fix asap.
Can you reproduce the BLE for -1 position issue? Do you require any more information / examples on how and when this is likely to happen?
here my jsp javax.swing.text.BadLocationException: Invalid offset=-1 not within <0, 4600> ---------8<---------------------- <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <fmt:setBundle basename="it.codd_date.r_c_s.newssearch.nl.ARCS_MG_SEARCH_PRESSAREA_CENTER" /> <%String tableWidth = "width=\"500\"";%> <form method="POST" action="<portlet:actionURL/>"> <%-- search criteria --%> <table <%=tableWidth%>> <tr> <td><fmt:message key='label_find' /></td> <td><input type="text" name="find" id="<portlet:namespace/>find" value="<c:out value="${ARCS_MG_SEARCH_find}"/>"/></td> <td width="50%"></td> <td nowrap> <input type="checkbox" value="Y" name="onlytitle" id="<portlet:namespace/>onlytitle" <c:out value="${ARCS_MG_SEARCH_onlytitle=='Y' ? 'CHECKED' : ''}"/>> <label for="<portlet:namespace/>onlytitle"><fmt:message key='label_onlytitle' /></label> </td> <td nowrap> <input type="checkbox" value="Y" name="pricesensitive" id="<portlet:namespace/>pricesensitive" <c:out value="${ARCS_MG_SEARCH_pricesensitive=='Y' ? 'CHECKED' : ''}"/>> <label for="<portlet:namespace/>pricesensitive"><fmt:message key='label_pricesensitive' /></label> </td> </tr> </table> <table <%=tableWidth%>> <tr> <td><fmt:message key='label_month' /></td> <td> <select name="month" id="<portlet:namespace/>month"> <c:forEach var="month" items="${ARCS_MG_SEARCH_list_months}"> <option value="<c:out value="${month}"/>" <c:out value="${month == ARCS_MG_SEARCH_list_months_SELECTED ? 'SELECTED' : ''}"/>><c:out value="${month}"/> </c:forEach> </select> </td> <td><fmt:message key='label_year' /></td> <td> <select name="year" id="<portlet:namespace/>year"> <c:forEach var="year" items="${ARCS_MG_SEARCH_list_years}"> <option value="<c:out value="${year}"/>" <c:out value="${year == ARCS_MG_SEARCH_list_years_SELECTED ? 'SELECTED' : ''}"/>><c:out value="${year}"/> </c:forEach> </select> </td> <td width="50%"></td> <td><input type="submit" value="<fmt:message key='label_button_find' />"/></td> </tr> </table> <%-- navigation --%> <table <%=tableWidth%>> <tr> <td align="left"><span><b>18 risultati</b> rilevati per <b><c:out value="${ARCS_MG_SEARCH_find}"/></b></span></td> <td align="right"><span>|<< < Pagina 4/10 > >>|</span></td> </tr> </table> <%-- results --%> <table <%=tableWidth%>> <tr><td><span> </span></td></tr> <tr><td style="background-color: #F3F8FC; border-top: 1px solid #DDD;"><span style="color: #007ECB;"> 16 settembre 2007- h 21:30 </span> <img src="<c:url value="/img/pricesensitive.gif"/>"></td></tr> <tr><td><span style="color: #000;"><b>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec diam nibh, dictum fringilla, ultricies in, laoreet ut, ante. Mauris interdum orci in urna. Aenean in magna. Nunc feugiat tempor lectus. Phasellus tortor nulla, lacinia a, placerat non, feugiat non, metus.</b></span></td></tr> <tr><td><span> Download</span> <img src="<c:url value="/img/pdf.gif"/>"></td></tr> <tr><td><span> </span></td></tr> <tr><td style="background-color: #F3F8FC; border-top: 1px solid #DDD;"><span style="color: #007ECB;"> 27 giugno 2007 </span> <img src="<c:url value="/img/pricesensitive.gif"/>"></td></tr> <tr><td><span style="color: #000;"><b>Suspendisse consectetuer. Etiam tempor tristique sem. Nunc semper pellentesque mi. Aenean eu metus. Suspendisse potenti. Nam gravida dolor vel nibh. Aenean dolor. Integer egestas, ipsum a sagittis viverra, nunc odio dapibus felis, id pharetra odio metus nec sapien. Sed dictum.</b></span></td></tr> <tr><td><span> Download</span> <img src="<c:url value="/img/pdf.gif"/>"></td></tr> <tr><td><span> </span></td></tr> <tr><td style="background-color: #F3F8FC; border-top: 1px solid #DDD;"><span style="color: #007ECB;"> 16 ottobre 2008- h 21:30 </span> <img src="<c:url value="/img/pricesensitive.gif"/>"></td></tr> <tr><td><span style="color: #000;"><b>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec diam nibh, dictum fringilla, ultricies in, laoreet ut, ante. Mauris interdum orci in urna. Aenean in magna. Nunc feugiat tempor lectus. Phasellus tortor nulla, lacinia a, placerat non, feugiat non, metus.</b></span></td></tr> <tr><td><span> Download</span> <img src="<c:url value="/img/pdf.gif"/>"></td></tr> </table> </form> ---------8<----------------------
and my nb version is Product Version: NetBeans IDE Dev (Build 080401) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: Linux version 2.6.24.2-smp running on i386; ISO-8859-1; en_US (nb)
this issue is similar to 130009 isn't it ?
Thanks for the file to reproduce the BLE -1 problem. It will help me a lot.
*** Issue 131800 has been marked as a duplicate of this issue. ***
The problem of -1 offset passed to the Utilities.getLineOffset() fixed in HtmlModel in main in revision 7a389aaba281. As for the offset > doc.getLength() - my previous conclusion was quite rushy - the document is readlocked during the ast visiting but I am not sure if is readlocked between parsing and calling the StructureScanner. It looks like it isn't. So I switched the exception report in such case to INFO level to not to bother users, but be able to track it if the problem is somewhere else. I guess it will not be happening so often. QE please verify, the fix may affect features based on AST like navigator, braces matching, semantic highl., folding and error reporting. OTOH it is quite simple and straightforward so I belive just quick sanity testing is enought.
Product Version: NetBeans IDE Dev (Build 080402) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: Linux version 2.6.24.2-smp running on i386; ISO-8859-1; en_US (nb) and no more exception, thanks :)
I don't see any regression after this fix in main. Please merge it into 6.1 clone.
marking as fixed (in main)
fixed in release61 clone in revision decadf420b1b
Verified in relese61.