JDK-4989831 : REGRESSION : Exception is getting thrown while page switching in a browser
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-02-06
  • Updated: 2004-02-20
  • Resolved: 2004-02-20
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.
Other
5.0 b40Fixed
Related Reports
Relates :  
Description
Tested_Java_Release   	: "1.5.0-beta2/1.5.0-beta
build/bundles	        :  1.5.0-beta2-b37/1.5.0-beta-b32d/latest PIT bundles
Tested_Java_Location 	: 
/net/koori/onestop/jdk/1.5.0/latest/bundles
/net/sqesvr-nfs/global/nfs/deployment3/tiger/PIT_builds
Tested_Machine_Name   	: dnm-011/jitender
Tested O/S           	: winxp/win2k

Problem Description :
Page switching in a browser is throwing following exception
java.lang.InternalError: obsolete interface used
	at sun.java2d.NullSurfaceData.getRaster(Unknown Source)
	at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(Unknown Source)
	at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
	at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
	at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
	at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
	at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
	at sun.plugin.AppletViewer.paintForegrnd(Unknown Source)
	at sun.plugin.AppletViewer.paint(Unknown Source)
	at sun.awt.RepaintArea.paintComponent(Unknown Source)
	at sun.awt.RepaintArea.paint(Unknown Source)
	at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)

it's working with fine with tiger build32d while reproducible with b37 and latest PIT bundles

Steps to reproduce:
1) Set Java console option in the java control panel to SHOW
2) Load the following applet in the browser
http://sqeweb.sfbay.sun.com/deployment2/jitu/plug-bug/test2.html
3) Notice the trace on the Java console,there should not be any exception
4) Click on the back button,then forward button. Wait for applet to get loaded
Repeat #4 and you will see the above mentioned Exception on the Java Console

On mozilla the exception will be thrown the very first time user clicks on the back button while on IE you need to do the process of < and  > two three times to see the exception

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b40 tiger-beta2
14-06-2004

EVALUATION The problem comes from our use, in recent builds of 1.5, of a new "NullSurfaceData" object. This static object is used to represent an invalid SurfaceData in situations where we used to simply use null. In order to remove a lot of pesky null checks in the code and just allow the code to flow logically, we created this simple object to noop many operations without throwing a NullPointerException. The bug here comes from the fact that this NullSurfaceData object does not implement the basic "getRaster()" functionality of all SurfaceDatas, so if you actually try to render to/from this object, you will get an InternalError and the ensuing stack trace reported in the Description of this bug report. This situation is occurring when the user is moving away from the applet (by clicking the Back or Forward keys of the browser to navigate off the applet page). Apparently we are being asked to render one last time, but when we got to retrieve the SurfaceData for the Component, we fail to get get one and we then substitute the NullSurfaceData object (instead of having the result be null, as before). The rendering operation proceeds and we end up attempting to Blit to this SurfaceData, which cannot work and should not happen. The reason this used to work is that there is a catch() clause for NullPointerException in our renderSurfaceData() function which correctly noops when there is a null surface data. But since we are now using a non-null object in this operation (NullSurfaceData is, after all, an actual object and not equal to "null"), we no longer get the exception and therefore end up eventually calling the getRaster() function on the object. The fix is to have the getRaster() function work just as it would on a null object; return a NullPointerException instead of the current InternalError. This way, when some caller is depending on this to work, we can throw the NPE which should eventually be caught and noop'd, just like before when we used to have null instead of NullSurfaceData. An alternate fix is to check for NullSurfaceData before performing the blit function and nooping at that point. This should be functionally equivalent to throwing an NPE from getRaster(), but only for this specific blit function. Ideally, throwing the NPE from getRaster() should handle similar situations in other rendering routines as well. ###@###.### 2004-02-11
11-02-2004