Ticket #2221 (closed defect: fixed)

Opened 19 months ago

Last modified 4 months ago

Unexcepted Exception when typing into "Change values?" box with an input method on Mac OS X

Reported by: wangchun Owned by: team
Priority: critical Component: Core
Version: Keywords:
Cc:

Description

To reproduce this error:

  • On Mac OS X v10.5 Leopard, select any node in JOSM
  • Add any property
  • Enter any value that could be auto-completed into the Value box

See also the attached image.

Attachments

Picture 1.png Download (37.9 KB) - added by wangchun 19 months ago.
step01.png Download (23.5 KB) - added by anonymous 19 months ago.
step02.png Download (12.3 KB) - added by anonymous 19 months ago.
step03.png Download (59.5 KB) - added by anonymous 19 months ago.
step04.png Download (88.1 KB) - added by anonymous 19 months ago.

Change History

Changed 19 months ago by wangchun

  Changed 19 months ago by anonymous

If you are able to reproduce this bug please do it and this time press the button "Report Bug". This will display necessary detailed information about the Exception and your system. Please append the displayed information to this ticket.

  Changed 19 months ago by stoecker

  • owner changed from team to wangchun
  • status changed from new to needinfo

  Changed 19 months ago by anonymous

Path: trunk
URL: http://josm.openstreetmap.de/svn/trunk
Repository Root: http://josm.openstreetmap.de/svn
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 1432
Node Kind: directory
Last Changed Author: stoecker
Last Changed Rev: 1432
Last Changed Date: 2009-02-20 17:33:15 +0100 (Fri, 20 Feb 2009)

Java version: 1.5.0_16
Plugins: usertools;utilsplugin;validator;wmsplugin
Plugin usertools Version: 13455
Plugin utilsplugin Version: 13776
Plugin validator Version: 13598
Plugin wmsplugin Version: 13796

java.lang.IllegalArgumentException: Invalid substring range
	at java.text.AttributedString$AttributedStringIterator.<init>(AttributedString.java:721)
	at java.text.AttributedString.getIterator(AttributedString.java:548)
	at javax.swing.text.Utilities.drawComposedText(Utilities.java:851)
	at javax.swing.text.PlainView.drawElement(PlainView.java:90)
	at javax.swing.text.PlainView.drawLine(PlainView.java:71)
	at javax.swing.text.PlainView.paint(PlainView.java:288)
	at javax.swing.text.FieldView.paint(FieldView.java:171)
	at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1339)
	at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:644)
	at apple.laf.CUIAquaTextField.paintSafely(CUIAquaTextField.java:90)
	at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:782)
	at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:761)
	at javax.swing.JComponent.paintComponent(JComponent.java:743)
	at javax.swing.JComponent.paint(JComponent.java:1006)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JComponent._paintImmediately(JComponent.java:4890)
	at javax.swing.JComponent.paintImmediately(JComponent.java:4676)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:477)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:180)
	at java.awt.Dialog$1.run(Dialog.java:535)
	at java.awt.Dialog$2.run(Dialog.java:565)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:563)
	at java.awt.Component.show(Component.java:1302)
	at java.awt.Component.setVisible(Component.java:1255)
	at org.openstreetmap.josm.gui.dialogs.PropertiesDialog.propertyEdit(PropertiesDialog.java:203)
	at org.openstreetmap.josm.gui.dialogs.PropertiesDialog$DblClickWatch.mouseClicked(PropertiesDialog.java:113)
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
	at java.awt.Component.processMouseEvent(Component.java:5605)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
	at java.awt.Component.processEvent(Component.java:5367)
	at java.awt.Container.processEvent(Container.java:2010)
	at java.awt.Component.dispatchEventImpl(Component.java:4068)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Component.dispatchEvent(Component.java:3903)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3945)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
	at java.awt.Container.dispatchEventImpl(Container.java:2054)
	at java.awt.Window.dispatchEventImpl(Window.java:1801)
	at java.awt.Component.dispatchEvent(Component.java:3903)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

  Changed 19 months ago by stoecker

Does this happen always (i.e. create a new empty layer with menu, add one node and test - probably you need two nodes to have autocompletion) or only with a specific data set? If later please also attach the data.

  Changed 19 months ago by anonymous

Yes. This always happens. Actually this problem had been there for months.

It only happens when user is trying to type with an input method editor (to enter Chinese or Japanese, for example). Since the error message was an "invalid substring range", I suggest you check if the code handle multi-byte character correctly.

Changed 19 months ago by anonymous

  Changed 19 months ago by anonymous

step by step:

1. open System Preferences -> International -> check "Simplified Chinese/ITABC" 2. now your can switch to "ITABC" input method by click the icon on the top-right corner of the screen, if you cannot see the icon, check "Show input menu in menu bar" in the Internationa system preferences. 3. You can try to type some Chinese character somewhere, for example, type "ceshi" and press spacebar in any input box should produce the characters "测试".

  Changed 19 months ago by anonymous

now, launch josm by typing command:

java -jar -Xdock:name=JOSM -Xmx256M -XX:MaxPermSize=256M josm-latest.jar

Changed 19 months ago by anonymous

  Changed 19 months ago by anonymous

Now, download some data from OSM, say 39.90–39.92 N, 116.38–116.41 E, as shown in the image:

Changed 19 months ago by anonymous

  Changed 19 months ago by anonymous

Now, select any node in the map view, click "Add" button in properties/memberships toolbox, in the "Change values?" popup dialog, enter anything (try "a<space>") into the "Please select a key" box, you should see the following:

Before typing into the box, ensure your activated input method is "ITABC" (you should be able to see a small PRC flag with letters "ABC" icon on the top-right corner of the screen, as in step02.png)

Changed 19 months ago by anonymous

follow-up: ↓ 11   Changed 19 months ago by stoecker

Hey nice. Didn't know josm trac can now access the attachement pictures in text :-)

Well, the problem is, that I have no Mac and also do not use Chinese. You do not by a chance have a Linux system and a step-by-step guide for it? If not fixing this relies on you help. The hint with the multi-byte-characters is not bad.

Some questions: a) You say this happens with the expansion. Can you make the same error without autoexpansion? b) The bug appears directly when the expansion starts, not when you leave the dialog?

in reply to: ↑ 10   Changed 19 months ago by anonymous

I can't reproduce this error on Linux. I guess this may be a Mac-only problem. (Perhaps Mac input method send application incomplete UTF-8 byte sequence? I dunno...)

How can I disable "auto complete" or "expansion" in JOSM?

  Changed 19 months ago by stoecker

Currently this cannot be disabled. Could you please answer the two last questions. We'll find a solution for this issue.

  Changed 19 months ago by anonymous

For the second question. You were right. The bug appears directly when the expansion starts, not when I leave the dialog.

For the first question, I think I can give you more information.

If you haven't used an input method. Here is a short explanation. For example, the Chinese character for "water" is "水" (U+6C30). In the "ITABC" input method, it is given a code: "shui". If someone wants to type "water" into a text box, what he/she need to do is switch the "ITABC" input method and hit keys "s"-"h"-"u"-"i".

So if there is already a node with a value of, for example, "shadow", in the map view, and user wants to enter "水" (U+6C30) as another node's value. When the user starts typing "s", auto-expansion is activated. On Mac OS X, not only the input method editor received the "s"-key pressed message, but also the application.

The similar thing is also found on Linux, too, but no error message is popped up. If you are running Debian or Ubuntu, try to apt-get install scim to add the CJK input method support. In a new JOSM layer, create two nodes, one fill with key="name", value="shadow" (without an IME activated), and once you are trying to set the value for the second node to "水" (U+6C30) by typing "shui" in the Simplified Chinese Pinyin IME, the following happens:

  1. type "s" - nothing appear in the box, but the IME shows a list of candidate characters;
  2. type "h" - auto-expansion worked. Now the value box looks as "shadosh", letter "a" is black-on-white, "hado" is in black-on-lightblue (selected), and "sh" is white-on-black. This is not right.
  3. type "u" and "i" and you get "shadoshui" not "水" (U+6C30) as expected.

Hope you understand all the explanation above :-)

  Changed 19 months ago by stoecker

  • owner changed from wangchun to stoecker
  • status changed from needinfo to assigned

Thanks for the description. For sure we can fix the exception. I'm not sure if we can fix it to work as expected without disabling autocomplete. But I will try :-)

  Changed 19 months ago by stoecker

Ok. I now installed scim+skim+chinese tables under Linux and when I choose "scim" input method in a KDE program and "zh-py" as method I get "水" for "shui". But I do not reach the same in josm or anywhere else where I cannot choose the KDE input method. Something must still be wrong.

  Changed 19 months ago by anonymous

I use GNOME. Can you show me a screenshot?

BTW, the keyboard shortcut to disable/enable IME is CTRL+SPACE.

  Changed 19 months ago by stoecker

Ah, required a restart. Well, I'm not used to restart my system after new installations. Works now as you describe. I will see if I can fix the issue.

  Changed 14 months ago by stoecker

  • owner changed from stoecker to team
  • status changed from assigned to new

  Changed 8 months ago by stoecker

Ticket #4154 has been marked as a duplicate of this ticket.

  Changed 8 months ago by anonymous

Ticket #3913 has been marked as a duplicate of this ticket.

  Changed 8 months ago by anonymous

Ticket #4297 has been marked as a duplicate of this ticket.

  Changed 7 months ago by stoecker

Ticket #4446 has been marked as a duplicate of this ticket.

  Changed 7 months ago by stoecker

Ticket #4481 has been marked as a duplicate of this ticket.

  Changed 7 months ago by stoecker

Ticket #4472 has been marked as a duplicate of this ticket.

  Changed 6 months ago by stoecker

Ticket #4590 has been marked as a duplicate of this ticket.

  Changed 6 months ago by mjulius

Ticket #4647 has been marked as a duplicate of this ticket.

  Changed 6 months ago by stoecker

Ticket #4680 has been marked as a duplicate of this ticket.

  Changed 6 months ago by stoecker

Ticket #4683 has been marked as a duplicate of this ticket.

  Changed 6 months ago by stoecker

  • priority changed from major to critical

  Changed 4 months ago by anonymous

Ticket #4966 has been marked as a duplicate of this ticket.

  Changed 4 months ago by stoecker

Ticket #4973 has been marked as a duplicate of this ticket.

  Changed 4 months ago by stoecker

Ticket #4977 has been marked as a duplicate of this ticket.

  Changed 4 months ago by bastiK

  • status changed from new to closed
  • resolution set to fixed

(In [3215]) fixed #4979 Exception when opening the download window; fixed #2221 - Unexcepted Exception when typing into "Change values?" box with an input method on Mac OS X

  Changed 4 months ago by bastiK

Ticket #4960 has been marked as a duplicate of this ticket.

Add/Change #2221 (Unexcepted Exception when typing into "Change values?" box with an input method on Mac OS X)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.