Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI problems with obfuscated byte code on jdk 1.4



np wrote:

I am having trouble with running an application that uses obfuscated jars on jre 1.4 (OS X 10.4.5, PPC G4). While the app runs with no problem on CoreDuo MiniMacs (10.4.8, jre.1.5.06), parts of the GUI will not properly draw on the older System. The app has a toolbar that uses JButtons with ImageIcons along with some other swing elements (JPopupMenu, JSpinner and some JTextFields). When started, the toolbar appears completely blank, clicking into it will make the GUI elements (also those with Icons) appear, but they tend to disappear again. I get the following Exception - that I do not really find any hints on in Google etc - printed to the console once (there is more than one image in the toolbar though and I am sure all the resources are present):

apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.NullPointerException
java.lang.NullPointerException
at apple.awt.CRenderer.copyImage(CRenderer.java:843)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3097)
at sun.awt.image.ImageRepresentation.drawToBufImage (ImageRepresentation.java:733)
at apple.awt.OSXImageRepresentation.drawToBufImage (OSXImageRepresentation.java:76)
at apple.awt.CRenderer.copyImage(CRenderer.java:838)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3097)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3087)
at javax.swing.ImageIcon.paintIcon(ImageIcon.java:322)
at apple.laf.AquaButtonUI.paintIcon(AquaButtonUI.java:486)
at apple.laf.AquaButtonUI.paint(AquaButtonUI.java:427)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:154)
at javax.swing.JComponent.paintComponent(JComponent.java:552)
at javax.swing.JComponent.paint(JComponent.java:840)
at javax.swing.JComponent.paintChildren(JComponent.java:674)
at javax.swing.JComponent.paint(JComponent.java:849)
at javax.swing.JComponent.paintChildren(JComponent.java:674)
at javax.swing.JComponent.paint(JComponent.java:849)
at java.awt.GraphicsCallback$PaintCallback.run (GraphicsCallback.java:34)
at sun.awt.SunGraphicsCallback.runOneComponent (SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents (SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1325)
at sun.awt.RepaintArea.paint(RepaintArea.java:194)
etc.


Everything works fine with non-obfuscated byte code. I tried various ways of keeping methods and classes related to the GUI non- obfuscated, but it does not seem to help. Apart from the GUI, things seem to work as expected regardless of obfuscation.
Has anybody seen something like this and maybe found a way to make it work.

How extensively have you tested to verify this is related to obfuscation? I find that diagnosis suspect for two reasons: there is no obfuscated code on the stack (all Sun or Apple code), and that I have seen similar intermittent exceptions myself in unobfuscated code. When I see traces like this with none of my code on the stack, I immediately start thinking JVM/JRE bug. This is reinforced by the version difference between the working and non-working cases. I reiterate Greg's suggestion to install J2SE5 on the G4 and see if it works. Is this issue intermittent, or does it fault every time? Also, try forcing a repaint by resizing the window. Do the icons suddenly appear? The exception will derail the paint process, so one component faulting in the initial paint operation will cause all subsequent components to not be painted. If another repaint will cause everything to appear (without a mouse click that could cause state changes) that would establish the exception as intermittent (a resize also causes containers to be re-laid-out, so that is another factor to consider).


I can think of one possible way you could cause this: since it is painting an ImageIcon, if the Image you provided is invalid this could fault (e.g. if you are loading it from a ResourceBundle, and that process does not account for obfuscation I'd expect it to fail everytime, everywhere). Invalid could include "not yet completely loaded", so try using a MediaTracker to ensure that the image is fully loaded before giving it to ImageIcon (I would expect ImageIcon to do this, but since I'm positing a JVM bug, this seems like a reasonable test).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.