#2221 closed defect (fixed)
Unexcepted Exception when typing into "Change values?" box with an input method on Mac OS X
Reported by: | wangchun | Owned by: | team |
---|---|---|---|
Priority: | critical | Milestone: | |
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 (5)
Change History (39)
by , 16 years ago
Attachment: | Picture 1.png added |
---|
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:3 by , 16 years ago
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)
comment:4 by , 16 years ago
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.
comment:5 by , 16 years ago
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.
by , 16 years ago
Attachment: | step01.png added |
---|
comment:6 by , 16 years ago
step by step:
- open System Preferences -> International -> check "Simplified Chinese/ITABC"
- 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.
- You can try to type some Chinese character somewhere, for example, type "ceshi" and press spacebar in any input box should produce the characters "测试".
comment:7 by , 16 years ago
by , 16 years ago
Attachment: | step02.png added |
---|
comment:8 by , 16 years ago
by , 16 years ago
Attachment: | step03.png added |
---|
comment:9 by , 16 years ago
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)
by , 16 years ago
Attachment: | step04.png added |
---|
follow-up: 11 comment:10 by , 16 years ago
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?
comment:11 by , 16 years ago
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?
comment:12 by , 16 years ago
Currently this cannot be disabled. Could you please answer the two last questions. We'll find a solution for this issue.
comment:13 by , 16 years ago
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:
- type "s" - nothing appear in the box, but the IME shows a list of candidate characters;
- 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.
- type "u" and "i" and you get "shadoshui" not "水" (U+6C30) as expected.
Hope you understand all the explanation above :-)
comment:14 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | needinfo → 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 :-)
comment:15 by , 16 years ago
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.
comment:16 by , 16 years ago
I use GNOME. Can you show me a screenshot?
BTW, the keyboard shortcut to disable/enable IME is CTRL+SPACE.
comment:17 by , 16 years ago
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.
comment:18 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:29 by , 15 years ago
Priority: | major → critical |
---|
comment:33 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.