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 234916

Summary: removing dependencies from library node in project window
Product: platform Reporter: williambacchi
Component: TextAssignee: Miloslav Metelka <mmetelka>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description williambacchi 2013-08-24 04:28:26 UTC
I was following TS 73 ApiSupportSanity with jdk 1.7.0_25 on 201308202300 ide build. If I remove a dependency from project.xml it is correctly removed from libraries node. If I add again the dependency in project.xml it is correctly added to libraries node. After this if I try to remove the dependency from libraries node I get an IllegalArgumentException: bad position.
Comment 1 Martin Kozeny 2013-08-28 12:05:21 UTC
You can only add dependency, then open project.xml and place caret and the last line. After that remove that dependency and you get also an IllegalArgumentException: bad position. Problem is with caret position, b/c project.xml file is modified (shortened) and after refresh it is not possible to place caret back to nonexistent position.
Comment 2 Martin Kozeny 2013-08-28 13:03:57 UTC
Problem is probably in openide.text DocumentOpenClose.DocumentLoad.run()->atomicLockedRun() in

for (int i = 0; i < reloadCaretOffsets.length; i++) {
   try {
      caretPositions[i] = loadDoc.createPosition(reloadCaretOffsets[i]);
   } catch (BadLocationException ex) {
      caretPositions[i] = loadDoc.getEndPosition();
   }
}

b/c loadDoc.createPosition(reloadCaretOffsets[i]) fails and returning an end position of caret comes from the old file. Returning loadDoc.getSartPosition() would help.
Comment 3 Martin Kozeny 2013-08-28 13:04:40 UTC
Reassigned to default owner.