Dollar symbol and ELComboBox(Read 6163 times)
Dollar symbol and ELComboBox on: October 21, 2009, 04:00:23 PM
Hi there,

One of my users just alerted me to a problem.  We are using the ELComboBox to manage international data (time series indicators of human well-being).  I use the combo box for them to pick an indicator/year pair, but it seems like certain characters do not work correctly.

If I create an indicator called 'test' and a year (say 2007), my combo box looks like

test 2007   (fine - the combo box behaves sensibly)

I then change the indicator name to 'test$'

It displays fine, but when the user selects that element I get an IndexOutOfBoundsException (partial trace below).

We can work around the problem by renaming our indicator from 'US$' to 'USD', but I'd be interested to know if there is a better known workaround (e.g. like me escaping certain characters) and also whether I should be wary of other characters that might causes this exception.  I can trap problematic characters at the input time, if I know them.



Exception occurred during event dispatching:
java.lang.StringIndexOutOfBoundsException: String index out of range: 5
   at java.lang.String.charAt(
   at java.util.regex.Matcher.appendReplacement(
   at java.util.regex.Matcher.replaceAll(
   at java.lang.String.replaceAll(
   at Source)
   at com.eltima.components.ui.ELComboBox.a(Unknown Source)
   at com.eltima.components.ui.ELComboBox.access$23(Unknown Source)
   at com.eltima.components.ui.ELComboBox$i.mouseClicked(Unknown Source)
   at java.awt.AWTEventMulticaster.mouseClicked(

Re: Dollar symbol and ELComboBox Reply #1 on: October 22, 2009, 12:12:19 PM
Please, read the following article:

Re: Dollar symbol and ELComboBox Reply #2 on: October 22, 2009, 03:33:00 PM
hey travis,

thanks for the reply.  do you work for Eltima?  if so, do you consider this a bug?  at the very least i think it should be documented (on the javadoc probably), as the user of your component shouldnt have to assume you are using Java regexp stuff (we are abstracted from your internal implementation, after all).  it would seem to make sense that the component escapes any dodgy characters before it passes it off to the regexp.  it is actually harder for me to do it than you too, as i just put objects into my ELComboBox and rely on the toString() implementation to display it to the user.  Therefore, it is not an especially easy fix as the toString() implementation would somehow have to exhibit different behavior (by escaping the $ symbol) depending on the context.  My workaround is going to have to entail wrapping my object in something that takes care of the escaping before putting it into the ELComboBox.

anyway, thanks for the swift response. 


Re: Dollar symbol and ELComboBox Reply #3 on: October 23, 2009, 05:26:18 PM
I would not call it a bug, rather a peculiarity of Visual Java/SWING Components Library work. We will consider enhancing functionality of Visual Java/SWING Components Library in one of the future releases.


Sitemap 1 2 3 4 5