Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4198073

compressed gif not loading from jar file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • jar
    • x86
    • windows_nt



      Name: dbT83986 Date: 12/16/98


      public static Image getImage (String imageFileName, Component component)
      {
        Image img = null;
        try
        {
           MediaTracker tracker = new MediaTracker (component);
           InputStream in = component.getClass ().getResourceAsStream (imageFileName);
           if (in == null)
           {
      System.out.println ("Image " + imageFileName + " not found.");
      return null;
           }
           byte[] buffer = new byte[in.available ()];
           in.read (buffer);

           img = Toolkit.getDefaultToolkit ().createImage (buffer);
           tracker.addImage (img, 0);
           tracker.waitForID (0);
           if (tracker.statusID () == tracker.ERRORED)
              System.out.println ("Error loading image");
         }
         catch (java.io.IOException ex)
         {
           System.out.println ("Unable to read image.");
         }
         catch (InterruptedException ex) {}
         return img;
      }

      Above code is used to load gif image into application
      imageFileName is image path. Let me enumerate now
      when it works:
      in applet deployed to compressed jar in Netscape4.05+/IE4.01
      in application not deployed to jar with JRE 1.1.5+/JRE 1.2
      in application deployed to compressed jar with JRE 1.1.5+.

      It does not work from compressed jar with JRE 1.2.
      Trackers return ERRORED in such case. What we've
      additionally found out, is that, if we have whole
      jar compressed, but gifs inside uncompressed -
      it works fine.

      Other words: compressed gif deployed to jar isn't
      loading properly with JRE1.2. It used to load with
      JRE 1.1 and browsers VMs.
      (Review ID: 47712)
      ======================================================================

            zlisunw Zhenghua Li (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: