JDK-6596915 : JCK-runtime-6a/tests/api/java_awt/Component/index.html tesPaintAll fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u2,6u22,7,7-pool
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,solaris_2.5.1,solaris_10
  • CPU: generic,x86,sparc
  • Submitted: 2007-08-24
  • Updated: 2021-03-31
  • Resolved: 2011-08-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u291Fixed 8 b01Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
JCK test JCK-runtime-6a/tests/api/java_awt/Component/index.html testPaintAll fails on linux 
Here is the output: http://moonblade.russia.sun.com/set/java/jck/qa-results/jdk_results/jdk7/b16/JCK6a/runtime-SUSE10-x86-client-Xint-Xconcgc-Xbatch-Xdebug/workDir/api/java_awt/Component/index.jtr

A standalone test is written and it seem reproduces the problem on Ubuntu Linux with GNOME. 
import java.awt.*;
import javax.swing.*;
import java.awt.image.BufferedImage;

public class TestPaintAll {

    public static void main(String [] args) throws Exception {

            Component lwComponentStub;
            Button hwComponentStub;
            Frame frame;

                lwComponentStub = new Component(){
			public void paint(Graphics g) {
				System.out.println("LW paint() call");
                        }
		};

                hwComponentStub = new Button(){
			public void paint(Graphics g) {
				System.out.println("HW paint() call");
                        }
		};
                BufferedImage graphicsProducer = 
                    new BufferedImage(BufferedImage.TYPE_INT_ARGB,1,1);
            
                Graphics g = graphicsProducer.getGraphics();
                

                frame = new Frame();
                frame.setLayout(new GridLayout());
                frame.add(lwComponentStub);
                frame.add(hwComponentStub);
                frame.setSize(new Dimension(50,50));
                frame.setVisible(true);

		System.out.println("1-------------------");
		Thread.sleep(3000);
		System.out.println("2-------------------");

                frame.paintAll(g);
               //frame.paintAll(frame.getGraphics());
    }
}

On Linux it prints: 
1-------------------
LW paint() call
LW paint() call
HW paint() call
2-------------------

On Windows it prints:
1-------------------
LW paint() call
HW paint() call
2-------------------
LW paint() call
HW paint() call

On Linux with Motif enabled it prints: 
1-------------------
LW paint() call
LW paint() call
HW paint() call
2-------------------
LW paint() call
HW paint() call

Comments
EVALUATION -
02-09-2011

EVALUATION .
05-05-2011

EVALUATION .
05-05-2011

EVALUATION I implemented all suggested fixes and still see the same rare random failures in different PaintUpdateTests. Tests by itself is unstable See CR 6835584 and 6571823, against jck tests.
05-05-2011

EVALUATION To conform the mentioned test we should state that we now invoke the paint() method of every descendant and thus have to change the implementation. It's expected to experience 1) a performance hit due to excessive calls and 2) regressions after a changed implementation details. Taking that into account we decided to document current behavior rather then comply with the test.
19-06-2008

SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/8/6596915/
20-02-2008

EVALUATION XAWT peers don't make up-call to super class from the paint(Graphics) method. I've done two things: - uncomment a multicasting code in XPanelPeer.java SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance(). runComponents(((Container)target).getComponents(), g, SunGraphicsCallback.LIGHTWEIGHTS | SunGraphicsCallback.HEAVYWEIGHTS); - call super.paint(g) from every XAWT's component peer. As the result, total number of paint() calls increased for that particular test from description.
20-02-2008

EVALUATION WComponentPeer query its assigned target to paint it's content by triggering following chunk of code: public void paint(Graphics g) { ((Component)target).paint(g); } Though, XComponentPeer has empty paint() method body. Unifying them together eliminates the problem with missing "LW paint() call" message from the test. At the same time HW still don't get that invcation.
20-02-2008

EVALUATION The issue is only observed in a single environment. Initial paint() invocation is also doesn't happen there for HW component.
27-08-2007

EVALUATION For now I'm not sure about the nature of that defect. Note, that using a graphics context taken from the frame itself makes the problem to disappear on some WMs (uncomment the line in the test) but on others - not. The specification for paintAll() method is rather brief. Painting guideline may help.
24-08-2007