[PATCH] fix OpenJDK [Sun]FontManager typo

Showing 1-3 of 3 messages
[PATCH] fix OpenJDK [Sun]FontManager typo Damjan Jovanovic 8/5/12 11:14 AM
Hi

http://josm.openstreetmap.de/josm-tested.jar dies on startup with "java/lang/UnsatisfiedLinkError: sun/font/SunFontManager.initIDs()V". This is because you misspelt "sun/font/SunFontManager" as "sun/font/FontManger", which the attached patch fixes.

However after fixing this I get a crash in libmawt.so:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007fffef2b3fea in ?? () from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
#2  0x00007fffef2b9658 in Java_sun_awt_X11GraphicsConfig_makeColorModel () from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
#3  0x00007ffff7fd5bf8 in detectFeature () from build/linux-x86_64-openjdk/libjvm.so
#4  0x00007ffff7fc423a in ?? () from build/linux-x86_64-openjdk/libjvm.so
#5  0x00007ffff7fbbf77 in ?? () from build/linux-x86_64-openjdk/libjvm.so
#6  0x00007ffff7fbe837 in ?? () from build/linux-x86_64-openjdk/libjvm.so
#7  0x000000004000007b in ?? ()
#8  0x00000000f5a8e939 in ?? ()
#9  0x00000000402aa51c in ?? ()
#10 0x00007fffdddc40a0 in ?? ()
#11 0x000000000040bef0 in ?? ()
#12 0x0000000000000000 in ?? ()

Also I can't run that JAR file with "-jar /path/to/josm-tested.jar", I have to use "-cp /path/to/josm-tested.jar JOSM", due to a "Main-Class manifest header not found in /home/user/josm-tested.jar" error which is not true. And on ARM even that doesn't work (some bizarre security exception), and I have to unzip the JAR and run it like that.

Regards
Damjan

Re: [PATCH] fix OpenJDK [Sun]FontManager typo Joel Dice 8/5/12 6:42 PM
On Sun, 5 Aug 2012, Damjan Jovanovic wrote:

> Hi
> http://josm.openstreetmap.de/josm-tested.jar dies on startup with
> "java/lang/UnsatisfiedLinkError: sun/font/SunFontManager.initIDs()V". This
> is because you misspelt "sun/font/SunFontManager" as "sun/font/FontManger",
> which the attached patch fixes.

It's not really a misspelling.  OpenJDK 6 had a class named FontManager,
and no class named SunFontManager, whereas OpenJDK 7 seems to have changed
FontManager into an interface and added SunFontManager as an abstract
superclass for at least two implementations: X11FontManager and
Win32FontManager.  Anyway, initIDs has indeed been moved into
SunFontManager, so I've committed your patch.  Thanks.

> However after fixing this I get a crash in libmawt.so:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000000000 in ?? ()
> (gdb) bt
> #0 �0x0000000000000000 in ?? ()
> #1 �0x00007fffef2b3fea in ?? () from
> /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
> #2 �0x00007fffef2b9658 in Java_sun_awt_X11GraphicsConfig_makeColorModel ()
> from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
> #3 �0x00007ffff7fd5bf8 in detectFeature () from
> build/linux-x86_64-openjdk/libjvm.so
> #4 �0x00007ffff7fc423a in ?? () from build/linux-x86_64-openjdk/libjvm.so
> #5 �0x00007ffff7fbbf77 in ?? () from build/linux-x86_64-openjdk/libjvm.so
> #6 �0x00007ffff7fbe837 in ?? () from build/linux-x86_64-openjdk/libjvm.so
> #7 �0x000000004000007b in ?? ()
> #8 �0x00000000f5a8e939 in ?? ()
> #9 �0x00000000402aa51c in ?? ()
> #10 0x00007fffdddc40a0 in ?? ()
> #11 0x000000000040bef0 in ?? ()
> #12 0x0000000000000000 in ?? ()

That's because the JNI methods PushLocalFrame and PopLocalFrame haven't
been implemented yet.  The attached patch will get around that, but it
leaks memory; a proper implementation must track local references
allocated in each frame and free them when that frame is popped.  I'll
work on that when I have time.

Unfortunately, it looks like there are further problems waiting after this
problem is fixed.  No surprise, really -- Swing/AWT hasn't really been
tested yet with Avian.  I'll see if I can debug it into shape when I have
a chance.

> Also I can't run that JAR file with "-jar /path/to/josm-tested.jar", I have
> to use "-cp /path/to/josm-tested.jar JOSM", due to a "Main-Class manifest
> header not found in /home/user/josm-tested.jar" error which is not true.

I didn't realize manifest attribute names should be parsed in a
case-insensitive manner.  That's fixed now:

https://github.com/ReadyTalk/avian/commit/5a7c78e71ac7b4045c23d215162fb12848f1a5f3

> And on ARM even that doesn't work (some bizarre security exception), and
> I have to unzip the JAR and run it like that.

I haven't had a chance to look at that yet, but I will later.
Re: [PATCH] fix OpenJDK [Sun]FontManager typo Joel Dice 8/14/12 10:03 AM
On Sun, 5 Aug 2012, Joel Dice wrote:

> On Sun, 5 Aug 2012, Damjan Jovanovic wrote:
>
>> However after fixing this I get a crash in libmawt.so:
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0000000000000000 in ?? ()
>> (gdb) bt
>> #0 ᅵ0x0000000000000000 in ?? ()
>> #1 ᅵ0x00007fffef2b3fea in ?? () from
>> /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
>> #2 ᅵ0x00007fffef2b9658 in Java_sun_awt_X11GraphicsConfig_makeColorModel ()
>> from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/xawt/libmawt.so
>> #3 ᅵ0x00007ffff7fd5bf8 in detectFeature () from
>> build/linux-x86_64-openjdk/libjvm.so
>> #4 ᅵ0x00007ffff7fc423a in ?? () from build/linux-x86_64-openjdk/libjvm.so
>> #5 ᅵ0x00007ffff7fbbf77 in ?? () from build/linux-x86_64-openjdk/libjvm.so
>> #6 ᅵ0x00007ffff7fbe837 in ?? () from build/linux-x86_64-openjdk/libjvm.so
>> #7 ᅵ0x000000004000007b in ?? ()
>> #8 ᅵ0x00000000f5a8e939 in ?? ()
>> #9 ᅵ0x00000000402aa51c in ?? ()
>> #10 0x00007fffdddc40a0 in ?? ()
>> #11 0x000000000040bef0 in ?? ()
>> #12 0x0000000000000000 in ?? ()
>
> That's because the JNI methods PushLocalFrame and PopLocalFrame haven't been
> implemented yet.  The attached patch will get around that, but it leaks
> memory; a proper implementation must track local references allocated in each
> frame and free them when that frame is popped.  I'll work on that when I have
> time.
>
> Unfortunately, it looks like there are further problems waiting after this
> problem is fixed.  No surprise, really -- Swing/AWT hasn't really been tested
> yet with Avian.  I'll see if I can debug it into shape when I have a chance.

I've added proper implementations of PushLocalFrame and PopLocalFrame, as
well is fixing a few other issues that preventing JOSM from running
properly.  It seems to be working now.

>> And on ARM even that doesn't work (some bizarre security exception), and I
>> have to unzip the JAR and run it like that.
>
> I haven't had a chance to look at that yet, but I will later.

This is also fixed.