United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7073211 javax.swing.JComponent.paint problem for org.freehep.graphics2d.VectorGraphics
JDK-7073211 : javax.swing.JComponent.paint problem for org.freehep.graphics2d.VectorGraphics

Details
Type:
Bug
Submit Date:
2011-07-31
Status:
Closed
Updated Date:
2012-09-06
Project Name:
JDK
Resolved Date:
2011-07-31
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P4
Resolution:
Not an Issue
Affected Versions:
7
Fixed Versions:

Related Reports

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)


ADDITIONAL OS VERSION INFORMATION :

Ubunto 11.04 (32 -bit)
Linux 1 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:05:41 UTC 2011 i686 i686 i386 GNU/Linux

and RHEL5 (64 bit)
Linux 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:12:32 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

I think this is a problem for any Linux. For windows I did not detect this bug

EXTRA RELEVANT SYSTEM CONFIGURATION :
A standard Linux desktop (either 32 bit or 64 bit)

A DESCRIPTION OF THE PROBLEM :
The package http://java.freehep.org/vectorgraphics/ is totally broaken  on java7. All tests have failed.
However, the same package works fine for Java6 and for Java7 on Windows ( the latter is a clear indication of a Java7 bug for Linux)

The package   http://java.freehep.org/vectorgraphics/  is in a part of many applications and I think they are all
have problems.

REGRESSION.  Last worked in version 6u26

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Copy the latest library ftp://ftp.slac.stanford.edu/software/freehep/VectorGraphics/v2.1.1/

 Get src package. Maven it. It should compiles fine.

Look at the example file: src/main/examples/ExportDialogExample.java

Execute it

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -

You should see a frame with 6 lines.
ACTUAL -
Nothing! See the errors

ERROR MESSAGES/STACK TRACES THAT OCCUR :
 [java] Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
     [java] 	at org.freehep.graphics2d.VectorGraphics.create(VectorGraphics.java:538)
     [java] 	at MyPanel.paintComponent(ExportDialogExample.java:88)
     [java] 	at javax.swing.JComponent.paint(JComponent.java:1054)
     [java] 	at javax.swing.JComponent.paintChildren(JComponent.java:887)
     [java] 	at javax.swing.JComponent.paint(JComponent.java:1063)
     [java] 	at javax.swing.JComponent.paintChildren(JComponent.java:887)
     [java] 	at javax.swing.JComponent.paint(JComponent.java:1063)
     [java] 	at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
     [java] 	at javax.swing.JComponent.paintChildren(JComponent.java:887)
     [java] 	at javax.swing.JComponent.paintToOffscreen(JComponent.java:5228)
     [java] 	at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295)
     [java] 	at javax.swing.RepaintManager.paint(RepaintManager.java:1206)
     [java] 	at javax.swing.JComponent.paint(JComponent.java:1040)
     [java] 	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
     [java] 	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
     [java] 	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
     [java] 	at java.awt.Container.paint(Container.java:1967)
     [java] 	at java.awt.Window.paint(Window.java:3867)
     [java] 	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:781)
     [java] 	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)
     [java] 	at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)
     [java] 	at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
     [java] 	at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1621)
     [java] 	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
     [java] 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
     [java] 	at java.awt.EventQueue.access$000(EventQueue.java:101)
     [java] 	at java.awt.EventQueue$3.run(EventQueue.java:666)
     [java] 	at java.awt.EventQueue$3.run(EventQueue.java:664)
     [java] 	at java.security.AccessController.doPrivileged(Native Method)
     [java] 	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     [java] 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
     [java] 	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
     [java] 	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
     [java] 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
     [java] 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
     [java] 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
     [java] 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
     [java] Caused by: java.lang.NullPointerException
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java] 	at java.lang.reflect.Method.invoke(Method.java:601)
     [java] 	at org.freehep.graphics2d.PixelGraphics2D.<clinit>(PixelGraphics2D.java:101)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
You will get it from here:
http://java.freehep.org/vectorgraphics/

Get the package:
ftp://ftp.slac.stanford.edu/software/freehep/VectorGraphics/v2.1.1/vectorgraphics-2.1.1-src.zip

unzip, maven it.

Then run the example:  src/main/examples/ExportDialogExample.java

I've checked  all examples in the package "reehep-graphicsio-tests". they are all broaken

You may also get binary files from here:
ftp://ftp.slac.stanford.edu/software/freehep/VectorGraphics/v2.1.1/vectorgraphics-2.1.1-bin.zip
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Could no find any method. The only method is bypassing Java7 and move back to Java6

Or use only  Windows machines with java7!

                                    

Comments
EVALUATION

This absolutely is a bug in the freehep package. I'm surprised the submitter
did not do the due diligence of looking at the line in the source code that
generated the NPE. If so he would have seen that freehep is looking for
an internal method and calling it. Its no longer in the same place due
to internal refactoring and that is entirely OK. Any app that relies on
JDK internals takes on all resposonsibility for that. Its completely
non-portable.

I've done the due diligence here :-
    private static boolean displayLocal;

    static {
        symbols = new HashMap();

        displayX11 = false;
        displayLocal = false;
        try {
            Class clazz = Class.forName("sun.awt.X11GraphicsEnvironment"); <<  JDK internal
            displayX11 = true;
            Method method = clazz.getMethod("isDisplayLocal", null);
            Boolean result = (Boolean) method.invoke(null, null); << EXCEPTION HERE:
                                     
2011-07-31



Hardware and Software, Engineered to Work Together