United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6726667 D3D: sun.java2d.InvalidPipeException is thrown when resizing JInternalFrame in a non-opaque JFrame
JDK-6726667 : D3D: sun.java2d.InvalidPipeException is thrown when resizing JInternalFrame in a non-opaque JFrame

Details
Type:
Bug
Submit Date:
2008-07-17
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2008-09-23
Component:
client-libs
OS:
windows
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u10 (b31)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
Resizing a JInternalFrame in a non-opaque JFrame may lead to throwing the sun.java2d.InvalidPipeException. It also produces a visual garbage on the screen.
It is reproducible with 6u10b27 on Vista. 

EXCEPTION STACK TRACE:
****************************************************
Exception in thread "AWT-EventQueue-0" sun.java2d.InvalidPipeException: bounds c
hanged or surface lost
        at sun.java2d.pipe.BufferedContext.validate(Unknown Source)
        at sun.java2d.pipe.BufferedContext.validateContext(Unknown Source)
        at sun.java2d.pipe.BufferedContext.validateContext(Unknown Source)
        at sun.awt.windows.TranslucentWindowPainter$VIOptWindowPainter.update(Un
known Source)
        at sun.awt.windows.TranslucentWindowPainter.updateWindow(Unknown Source)

        at sun.awt.windows.WWindowPeer.updateWindow(Unknown Source)
        at java.awt.Window.updateWindow(Unknown Source)
        at java.awt.Window.access$900(Unknown Source)
        at java.awt.Window$1.updateWindow(Unknown Source)
        at javax.swing.RepaintManager.updateWindows(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
n Source)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source) 
****************************************************

TEST APPLICATION:
****************************************************
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.lang.reflect.*;

public class NonOpaqueWindowTest2 extends JFrame
{
  public NonOpaqueWindowTest2()
  {
    super();    
    setWindowNonOpaque(this);
    
    JDesktopPane desktop = new JDesktopPane();
    JInternalFrame iFrame = new JInternalFrame("Test", true, true, true, true);
    iFrame.add(new JLabel("internal Frame"));
    iFrame.setBounds(10, 10, 300, 200);
    iFrame.setVisible(true);
    desktop.add(iFrame);    
    getContentPane().add(desktop);
    
    setTitle(getClass().getSimpleName());
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 400);
    setLocationRelativeTo(null);
    setVisible(true);
  }
  
  private void setWindowNonOpaque(Window w)
  {
    try 
    {
      Class<?> c = Class.forName("com.sun.awt.AWTUtilities");
      Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class);
      m.invoke(null, w, false);
    } 
    catch (Exception e) 
    {
      e.printStackTrace();
    }    
  }
 
  public static void main(String[] args) throws Exception
  {
    EventQueue.invokeLater(new Runnable(){
      public void run()
      {
        JFrame.setDefaultLookAndFeelDecorated(true);
        new NonOpaqueWindowTest2();
      }      
    });
  }  
}
****************************************************

STEPS TO REPRODUCE:
1. Run the application with 6u10b27 on Vista (I've verified it having Aero theme enabled).
2. Start resizing the internal frame with the mouse.
3. The exception stack trace is printed on the console.

The issue is reported here:
http://forums.java.net/jive/thread.jspa?threadID=43881&tstart=0

                                    

Comments
EVALUATION

Note that the exception can only occur with the D3D pipeline,
but the painting artifacts are reproducible with the D3D pipeline
disabled and I think may be cause dy some special painting 
code for internal frames - it coud be that our painting interception
mechianism for non-opaque windows missing the updates when
internal frame is dragged/resized.

I believe the exception and the painting problems are two unrelated
issues, so I'll file separate bug for painting problems.

Also, I can't reproduce the exception on XP, it may be Vista specific.
                                     
2008-07-17
EVALUATION

Even though I can't reproduce the exception yet I can see how it 
could happen. When BufferedContext is validated it may throw
an IPE which I was supposed to catch.
                                     
2008-07-17
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/java2d_data/6u11/6726667.0
                                     
2008-08-14



Hardware and Software, Engineered to Work Together