JDK-4191132 : Transforms hang VM when done from a subcomponent
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86
  • Submitted: 1998-11-18
  • Updated: 2005-10-08
  • Resolved: 2005-10-08
Related Reports
Duplicate :  
Description
Name: gsC80088			Date: 11/18/98


Dear Bug Report,




	When I run the program listed below using JDK 1.2 beta 4 on a wintel machine
running Windows NT 4.0 SP 3, JDK hangs.  The progam should plot an orange rectangle in
the window.  Instead, the "drawLine(" operation hangs the system.

	If this helps, the version number on my system's DirectDraw DLL is 4.04.


Sincerely,


Thorn Green
###@###.###


Program Code:
-------------


package geomdir;


import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
import com.sun.java.swing.border.*;


class MyComp extends JComponent
	{
	JFrame ParentFrame = null;

	public MyComp( JFrame in )
		{
		ParentFrame = in;
		}

	public void paint( Graphics g )
		{
		g.translate( 100 , -11 );
		g.setColor( Color.blue );

		double x1 = -40.999998613543994;
		double y1 = 294.99999002428;
		double x2 = 3.5710775851866464E65;
		double y2 = -5.26140589439125E49;

		g.drawLine( (int) x1 , (int) y1 , (int) x2 , (int) y2 );

		g.setColor( Color.orange );
		g.fillRect( -600 , -600 , 1200 , 1200 );
		g.setColor( Color.blue );

		g.drawLine( (int) x1 , (int) y1 , (int) x2 , (int) y2 );
		}


	}


public class TestApp4 extends Object
	{
	protected static JFrame MyF;
	protected static MyComp MyKit;
	
	protected static void initialize( String argv[] )
		{
		MyF = new JFrame();
		MyF.setSize( 400 , 400 );
		MyF.pack();
		MyF.setTitle( "Model Window" );
		MyKit = new MyComp( MyF );
		JPanel kPan = new JPanel();
		
		MyF.getContentPane().setLayout( new BorderLayout( 0 , 0 ) );
		MyF.getContentPane().add( "Center" , MyKit );
		}
		
	public static void main( String argv[] )
		{
		initialize( argv );
		MyF.pack();
		MyF.setSize( 400 , 400 );
		MyF.setVisible( true );
		}
	

	}
(Review ID: 37704)
======================================================================

Comments
EVALUATION The problem no longer reproduces on 1.4 or later releases. The new architecture introduced in 1.4 included new code to draw lines with much more robust clipping code. This bug is therefore a duplicate of 4228939.
08-10-2005

EVALUATION The problem appears to be in ShortDiscreteRenderer.c::adjustLine. The painting thread enters this code and then goes into an infinite loop, forever fulfilling the ((outcode1 | outcode2) != 0) condition. outcode2 appears to oscillate between OUTCODE_BOTTOM and OUTCODE_LEFT on each iteration of the while loop. This bug does not appear when drawing directly to a Frame, for example, because adjustLine is not called when painting to a Frame. However, the following program does cause an assertion failure when running under java_g: import java.awt.*; import java.awt.event.*; class MyComp extends Frame { public void paint( Graphics g ) { g.translate( 100 , -11 ); g.setColor( Color.blue ); double x1 = -40.999998613543994; double y1 = 294.99999002428; double x2 = 3.5710775851866464E65; double y2 = -5.26140589439125E49; g.drawLine( (int) x1 , (int) y1 , (int) x2 , (int) y2 ); g.setColor( Color.orange ); g.fillRect( -600 , -600 , 1200 , 1200 ); g.setColor( Color.blue ); g.drawLine( (int) x1 , (int) y1 , (int) x2 , (int) y2 ); } } public class TestApp4 extends Object { protected static Frame MyF; protected static MyComp MyKit; protected static void initialize( String argv[] ) { MyF = new MyComp(); MyF.setSize( 400 , 400 ); MyF.pack(); MyF.setTitle( "Model Window" ); } public static void main( String argv[] ) { initialize( argv ); MyF.pack(); MyF.setSize( 400 , 400 ); MyF.setVisible( true ); } } Fatal error: 87 Assertion failed: ::LineTo(hDC, nX2, nY2), file ..\..\..\..\src\win32\native\sun \windows\awt_Graphics.cpp, line 432 Error 87 is described by the MSDN documentation as an Invalid Parameter. Perhaps the wacky values the submitter included in the test case are overflowing some variables and causing both the infinite loop and the assertion failure. david.mendenhall@eng 1998-11-18 Assigning bug to Jeannette on Greg Stone's recommendation. david.mendenhall@eng 1998-11-18
18-11-1998