JDK-6369066 : GIF images with loop tag and one single frame should not be animated
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-01-05
  • Updated: 2014-03-18
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
1.4.2_10

ADDITIONAL OS VERSION INFORMATION :
Windows98 Second Editon
Win2000 Professional SP4
WindowsXP Professional/Home SP2

EXTRA RELEVANT SYSTEM CONFIGURATION :
LAN 100Base-T
Platform : Win2000 Professional SP4

A DESCRIPTION OF THE PROBLEM :

The following program run, "CPU 100% usage "  always occurs.
 (JButton with non-transparent GIF Image put JPanel.)
combo_up.gif is "non transparent GIF " Image.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The case of  "transparent GIF " Image   "CPU 100% usage " doesn't occur.
 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
CPU usage of PC doesn't become 100%.
ACTUAL -
CPU usage of PC become 100%.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No, but action of Java Appliation become slow.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.net.*;


public class test extends Panel{
  ImageIcon imageIcon = new ImageIcon(test.class.getResource("combo_up.gif"));

  public test(){
    this.add(new JButton(imageIcon));
  }

  public static void main(String[] args){
    JFrame test1 = new JFrame("");

    test1.getContentPane().add(new test());
    test1.setSize(100,100);
    test1.setVisible(true);
  }
---------- END SOURCE ----------

Comments
Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
18-03-2014

WORK AROUND Make sure images that are not intended to be animated do not have any of the animation properties set in them. For this particular image, the GIF APPLICATION block with the string NETSCAPE2.0 should be removed.
09-01-2006

EVALUATION This bug has nothing to do with whether or not the image is transparent. The image is tagged with the GIF looping indicator (a GIF application data section containing "NETSCAPE2.0") which indicates that the image should be looped forever. Furthermore, the delay for the animation is set to 0ms so the image is told to loop "as fast as it can". The JRE is simply complying with the instructions in the GIF file by continually looping the image using the ImageObserver mechanism to notify the JButton that another frame should be displayed. The image only includes one frame though and so looping the image doesn't really make sense. The application that constructed the image should not have added the looping indicators for an image with one frame. While it might be possible for the JRE to detect this situation and ignore the looping indicator, but given the way that GIF files are constructed, the information on how many frames are in the file isn't known until well after a decision needs to be made as to whether or not to animate the image so that change will not be easy. Since this bug has a workaround (delete the looping indicators with an image editing application), the priority should be lowered and it should be changed to an RFE.
09-01-2006

EVALUATION I've been able to reproduce this and it appears to be a 2D issue. If I override imageUpdate on the test to dump whenever it is called, I can see that it is being called endlessly from 2D code: at test$1.imageUpdate(test.java:14) at sun.awt.image.ImageWatched$WeakLink.newInfo(ImageWatched.java:114) at sun.awt.image.ImageWatched.newInfo(ImageWatched.java:151) at sun.awt.image.ImageRepresentation.imageComplete(ImageRepresentation.java:651) at sun.awt.image.ImageDecoder.imageComplete(ImageDecoder.java:135) at sun.awt.image.GifFrame.dispose(GifImageDecoder.java:619) at sun.awt.image.GifImageDecoder.produceImage(GifImageDecoder.java:230) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:246) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
09-01-2006