There is a series of defects in IntelliJ 5.0 on Linux that go like this:
I can not open 'Appearance' settings in IDE Settings (File -> Settings -> Appearance).
The main problem is that it is system-specific bug. On other PCs everything works fine.
No appearance settings window opens and exception listed below appears in log:
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(194,244),button=1,modifiers=Button1,clickCount=1] on dialog9
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 5.0 Build #3436
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.5.0_04
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) Client VM
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - Vendor: Sun Microsystems Inc.
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - OS: Windows XP
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - Last Action: ShowSettings
2005-08-03 13:39:45,250 [ 733235] ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(194,244),button=1,modifiers=Button1,clickCount=1] on dialog9
java.lang.ArrayIndexOutOfBoundsException: -2147483648
at sun.font.CMap$CMapFormat4.getGlyph(CMap.java:540)
The defect status is a discouraging Won't Fix. The developer comment is:
This is identified Sun JRE issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6247425
Ok, what does that SUN bug say?
Bug ID: 6247425 Votes 0 Synopsis Unhandled OutOfBounds exception while parsing TTF files Category java:classes_2d Reported Against b28 Release Fixed mustang(b33) State Closed, fixed Related Bugs Submit Date 29-MAR-2005 Description For some TTF files with CMAP format 4 i am seeing following exception: java.lang.ArrayIndexOutOfBoundsException: -2147483648 at sun.font.CMap$CMapFormat4.getGlyph(CMap.java:547) at sun.font.TrueTypeGlyphMapper.charToGlyph(TrueTypeGlyphMapper.java:115) at sun.font.CharToGlyphMapper.canDisplay(CharToGlyphMapper.java:40) at sun.font.Font2D.canDisplay(Font2D.java:426) at java.awt.Font.canDisplay(Font.java:1780) xxxxx@xxxxx 2005-03-29 16:25:48 GMTWork Around N/AEvaluation Examining fonts with ttfdump it seems they are malformed - entrySelector=1024 and searchRange=8192 while segCount=22 (we read same numbers in CMap.java). This is weird because according to spec these numbers are derived from segCount. Proper values for table like this are 4 and 32 - so it looks like byteorder is wrong. We may either reject such fonts as malformed or simply ignore them and derive appropriate values ourselves. (windows shows these fonts with font viewer) In any case parsing CMAP we should catch all potential exceptions. xxxxx@xxxxx 2005-03-29 16:25:48 GMT
So, apparently, I have malformed fonts installed on my Linux box. But notice SUN's status: Closed, fixed, albeit in a future release.
IntelliJ's status of Won't fix is just stupid. Just surround the exception-throwing code with a handler and warn the user about broken fonts. This is infinitely better than crashing. And for bonus points, backport the JDK 6 fix to a replacement class so that IDEA can handle the broken fonts. What's so hard about that?
UPDATE: I just tried out Mustang b51 (JDK 1.6 beta) to see if the bug was indeed fixed. Again IDEA crashes. At least there is console output:
binkley@hermes:~/opt/idea/bin>java: ../../../src/share/native/sun/awt/font/t2k/t1.c:2178: tsi_T1GetGlyphIndexFromAdobeCode: Assertion `0' failed.
Time to go update the Closed, fixed SUN bug.
UPDATE: That was quick! Phil, the nice man from SUN, mailed me later after I posted the new bug:
6247425 was a bug in a TrueType font. The message here is a bug in a Type1 font. They are unrelated except that it sounds like you hit the first bug before you could reach the second bug and now you can reach the second bug. I recall that SuSE 9.2 Pro has a *LOT* of fonts of variable quality. We looked at those fonts - and there were a few - that caused a crash in the same area as this - it was bug 6229389 ixed it in mustang b33.
I especially appreciate that he provided me means further in the mail to track down the bad font. Thank you, Phil!
2 comments:
Well, in this particular case we could indeed surround work with Font (like querying infos, drawing, etc.) by building some inhouse wrapper around. But:
1. It will most probably help anyways since there numerous reports JVM crashes in native code trying to deal with these fonts (we'll hardly be able to work that around, right?)
2. Walking this way further will require to build a wrappers around _every_ thrid party code including both JDK and libraries and IDEA plugins. Isn't that silly? I mean some people asking something like: yes, I have buggy plugin installed but shouldn't IDEA itself be fault tolerant in this case?
Anyway... thanks, we'll try to get that around. No promises though.
Happiness... the developer whose comment I quoted replied. :)
I'm trying out Mustang b51 this morning to confirm that it fixes the problem. If so, I'm going to see how much work it is for me to back port the fixed class(es). If it works out easily, I'll post a JAR and instructions for gluing it into a default installation of IDEA.
Post a Comment