JDK-4821632 : Displaying Animated Gif in JEditorPane causes nonstop CPU usage
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2003-02-20
  • Updated: 2003-04-25
  • Resolved: 2003-04-25
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 tigerFixed
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 02/20/2003


FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When creating a JEditorPane and displaying HTML that
contains a refrence to an animated gif the CPU usages is
kept at 100% after component is destoyed.

See bug report 4215118 that gives workaround for JLabel and
JButton.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Create HTML that countains ref to animated gif.
2.Create new window that contains a JEditorPane with
content type HTML and load HTML into it.
3.From another window open window.
4.Animation should display.
4.Close window.
5. CPU usage does not return to what expected.


EXPECTED VERSUS ACTUAL BEHAVIOR :
CPU 0%


---- BEGIN SOURCE ----

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class AnimatedGifBUG{


    public AnimatedGifBUG(){
	
	JFrame frame = new JFrame();
	
	JButton button = new JButton("Press me!");
	
	button.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
		    for(int i  = 0 ; i<5;i++){
			showDialog(i);
		    }
				    
		}
		
	    });
	frame.getContentPane().add(button);
		frame.setSize(600,400);
		frame.show();


    }


    public static void main(String args[]){
	
	new AnimatedGifBUG();
	
    }

    
    private void showDialog(int i ){
	final JDialog dialog = new JDialog();
	
	JEditorPane pane = new JEditorPane();

	JButton button = new JButton("Close");

	button.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
				dialog.dispose();

		}

	});


	pane.setContentType("text/html");
	pane.setText("<img src=\"file://c:/webbugs/animation"+i+".gif\">");
	dialog.getContentPane().add(pane,BorderLayout.CENTER);
	dialog.getContentPane().add(button,BorderLayout.SOUTH);
	dialog.setSize(600,500);

	dialog.show();


    }

}


---- END SOURCE ----

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER WORKAROUND :
See bug report 4215118
(Review ID: 180813) 
======================================================================

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

EVALUATION Name: ik75403 Date: 02/28/2003 The cause of this bug is exactly the same as 4215118 ====================================================================== Name: anR10225 Date: 04/09/2003 We should just check this ImageView for getParent() == null and return false from ImageHandler.imageUpdate() ======================================================================
11-06-2004