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 201212140001) VM: Java HotSpot(TM) 64-Bit Server VM, 23.3-b01, Java(TM) SE Runtime Environment, 1.7.0_07-b10 OS: Mac OS X Stacktrace: java.lang.IllegalArgumentException: bad position: 11 at javax.swing.text.JTextComponent.moveCaretPosition(JTextComponent.java:1551) at com.raelity.jvi.swing.CommandLine$CommandLineEntry$2.focusGained(CommandLine.java:594) at java.awt.AWTEventMulticaster.focusGained(AWTEventMulticaster.java:220) at java.awt.Component.processFocusEvent(Component.java:6394) at java.awt.Component.processEvent(Component.java:6261) at java.awt.Container.processEvent(Container.java:2229)
Created attachment 129388 [details] stacktrace
com.raelity.jvi...
tomjnsn, Is this repeatable? Frequent/infrequent? Did it start with a recent NB-dev build? What jVi version? What is the jVi option setting for Tools>Options>jViConfig>Platform>useModalFrame?
digitalrounin, There have been three of these exceptions reported over the last year; always on a MAC running 1.7 JVM. The latest is yesterday. The exception occurs in some code that executes only on a MAC and was added in April of 2008. The code adds a focus gained listener to the text field in the commandLine combo box to adjust the text selection to work around some issue. I'm assuming that this occurs infrequently. It is only reported on JVM 1.7. The latest report, from digitalrounin, has a comment (thanks). It says Just performed ':s/\s\+$//g' in JVi The command that shows up in the combo box editor is 10 chars (don't count the ':'). So '11' for the position is bad (assuming it was working with the whole string). Could you clarify the "Just performed". Does this mean the exception occurred after pressing RETURN? Or maybe after running it and then entering ':' again? Can you recall if there might have been any type ahead (that is almost impossible to be sure of)? I could just have the code ignore the exception. This probably leaves the selection funny; but it is pretty infrequent.
Hey err, I cannot recall. I apologize. I will try and keep such things in mind when I file bugs in the future. Here is something interesting though. I tried to to recreate the issue and the funny thing is that my substitute command is not working at all. Recreation steps: 1. Put trailing spaces at random lines through out the file being edited. Please space chars. ' ' 2. Enter ex with ':' 3. Enter the following at ':', %s/\s\+$//g Result: 1. About 0.5 to 1 second delay, long time IMHO 2. Bell/alert rings once 3. 'hlsearch' highlights end of line for all lines 4. Trailing spaces have not beed removed. Number 3 of the result is also a little unexpected. I am going to try and attach a screen shot after I post this. Either way, I know that the trailing 'g' in '%s/\s\+$//g' is not needed, but it is still a valid command. I tested the command out on the same exact file in plain old Vim and it works.
Created attachment 139817 [details] Should not be highlighting end of line. I am not sure if this is a separate bug or related. FYI. Nothing in the Netbeans logs.
> I tested the command out on the same exact file in plain old Vim and it works. There is a discrepancy in the meaning of '\s' between vim and java. Java uses perl meaning and '\s' includes '\n' (and a few other things), but vim only include space and tab. I might consider simple substituting '[ \t]' for '\s' but I'm concerned this might fail in more complex examples, for example using negation. Issues related to this should be filed at jVi's sourceforge site. Instead of '%s/\s\+$//g', using '%s/[ \t]\+$//g' should give you the expected results. I'll see what I can recreate later today. Using a reluctant quantifier, as in '/\s+?$/' might work (but you may need to escape '+' and '?' depending on options)
For the upcoming bug fix release, the exception message contains additional information to get a better idea of what's going on. I've left the exception, rather than just outputting stuff, since it doesn't seem to cause any real problems.