Modify

Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#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)

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

Download all attachments as: .zip

Change History (39)

by wangchun, 15 years ago

Attachment: Picture 1.png added

comment:1 by anonymous, 15 years ago

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.

comment:2 by stoecker, 15 years ago

Owner: changed from team to wangchun
Status: newneedinfo

comment:3 by anonymous, 15 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 stoecker, 15 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 anonymous, 15 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 anonymous, 15 years ago

Attachment: step01.png added

comment:6 by anonymous, 15 years ago


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 "测试".

comment:7 by anonymous, 15 years ago


now, launch josm by typing command:

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

by anonymous, 15 years ago

Attachment: step02.png added

comment:8 by anonymous, 15 years ago

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


by anonymous, 15 years ago

Attachment: step03.png added

comment:9 by anonymous, 15 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 anonymous, 15 years ago

Attachment: step04.png added

comment:10 by stoecker, 15 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?

in reply to:  10 comment:11 by anonymous, 15 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 stoecker, 15 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 anonymous, 15 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:

  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 :-)

comment:14 by stoecker, 15 years ago

Owner: changed from wangchun to stoecker
Status: needinfoassigned

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 stoecker, 15 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 anonymous, 15 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 stoecker, 15 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 stoecker, 15 years ago

Owner: changed from stoecker to team
Status: assignednew

comment:19 by stoecker, 14 years ago

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

comment:20 by anonymous, 14 years ago

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

comment:21 by anonymous, 14 years ago

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

comment:22 by stoecker, 14 years ago

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

comment:23 by stoecker, 14 years ago

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

comment:24 by stoecker, 14 years ago

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

comment:25 by stoecker, 14 years ago

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

comment:26 by mjulius, 14 years ago

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

comment:27 by stoecker, 14 years ago

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

comment:28 by stoecker, 14 years ago

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

comment:29 by stoecker, 14 years ago

Priority: majorcritical

comment:30 by anonymous, 14 years ago

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

comment:31 by stoecker, 14 years ago

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

comment:32 by stoecker, 14 years ago

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

comment:33 by bastiK, 14 years ago

Resolution: fixed
Status: newclosed

(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

comment:34 by bastiK, 14 years ago

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.