Loading GIFs, MediaTracker sometimes doesn't wait

Hi,
I'm trying to solve this problem for a long time without any success. In my applet I load gif images into Image class. GIFs are generated by servlet and than loaded by applet. I use MediaTracker and most of the time images are loaded without any problem. But sometimes MediaTracker just doesn't wait for image to load. It's like there is something wrong with those gifs, but IE can load them and I can open them with PSP and everything is ok.
I even created a method that loads image file into an array and than create Image from byte array. Doesn't help.
Here is my code:
Image       img  = null;
try
    URL     url  = new URL(name);
    byte[]  file = getFile(url.openStream());
    img  = Toolkit.getDefaultToolkit().createImage(file);
    //img = Toolkit.getDefaultToolkit().getImage(new URL(name));
    MediaTracker tracker = new MediaTracker(this);
    tracker.addImage(img,0);
    tracker.waitForID(0,1000);
    if(tracker.isErrorID(0)) { System.out.println("error");}
catch (InterruptedException e) {System.out.println("loadImage-error"); }
catch (MalformedURLException e){System.out.println("loadImage-error"); }
catch (Exception e)            {System.out.println("loadImage-error"); }and getImage method:
public byte[] getFile(InputStream in) throws IOException
     int    bytesRead;
     byte[] buffer = new byte[4096];
     ByteArrayOutputStream bos = new ByteArrayOutputStream();
     while( (bytesRead = in.read(buffer,0,4096)) > 0 )
               bos.write(buffer,0,bytesRead);
     bos.flush();
     bos.close();
     return bos.toByteArray();

Mistery solved!
There was indeed problem in creating gif image files. Sometimes. Bug was in the LZW compression algorithm that I downloaded from the internet. Grrrr.
But be aware, bad images can be opened with IE or PSP, but fail to load by Java.
Matjaz
P.S. Needless to say, Duke Dolars are not offered anymore.

Similar Messages

  • When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours?

    When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours? Unfortunately - I've been reading that this lengthy download problem is quite common - although I thought I saw where someone had loaded videos the day before and then had them to watch later. So, my first rental - I downloaded it overnight - then we go to watch it tonight and it proceeds to start loading again...saying it will be ready in 14 hours and 21 minutes!!! Am I doing something wrong here? If anyone has advice - I would greatly appreciate it. This is the first apple product that I am disappointed with

    When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours? Unfortunately - I've been reading that this lengthy download problem is quite common - although I thought I saw where someone had loaded videos the day before and then had them to watch later. So, my first rental - I downloaded it overnight - then we go to watch it tonight and it proceeds to start loading again...saying it will be ready in 14 hours and 21 minutes!!! Am I doing something wrong here? If anyone has advice - I would greatly appreciate it. This is the first apple product that I am disappointed with

  • Firefox stops loading webpages after sometimes, stopping all plugincontainer.exe doesn't help either, help!

    I downloaded Firefox4 and started using it. It stopped loading webpages after sometime, I checked the task manager and found out that a lot of plugincontainer.exe processes are running, I stopped them all but that didn't help either. Please help.

    The page
    http://www.burton.com/Gear/Default.aspx#/other/urbanbags/cityline/subcat/subCat. swf
    requires the latest Flash Plug-In
    Un-install what's there now using
    http://fpdownload.macromedia.com/get/flashplayer/current/uninstallflash_playerosx.dmg
    Then install
    http://fpdownload.macromedia.com/get/flashplayer/current/installflash_player_osxub.dmg.zip

  • Finally got round to buying an iPhone 4, really excellent to start with. The sharing of music from my Mac Mini was excellent. ios6 update has ruined all that! The artist view miss's out most of my music and the sharing sometimes doesn't work at all!

    Finally got round to buying an iPhone 4, really excellent to start with. The sharing of music from my Mac Mini was excellent. ios6 update has ruined all that! The artist view miss's out most of my music and the sharing sometimes doesn't work at all!
    How do I get this feature working again? I am reluctant to move to iTunes 10.7 because I don't trust Apple at the moment.

    My suggestion:
    1) Always using MAC AIR with the power plug in.
    2)Don' let the power level of battory fall under 30% percentage.
    3)If the MAC can't be recharged now, just let it be with power plugged, WAIT...

  • GNOME desktop sometimes doesn't appear

    When I start computer and load GNOME through GDM, GNOME desktop sometimes doesn't appear. Both panels appear but wallpaper and icons don't appear, only gray background. I should press Ctrl+Alt+Backspace to reload X Window and after it desktop appears. How to fix this problem?

    I removed KDE 4.1 several days ago, installed GDM and wrote it in DAEMONS list to launch in /etc/rc.conf. On my work computer I have "clean" GNOME and never installed KDE there. And on my work everything is ok. Maybe I still have any remains of KDE on my home computer which make this problem?

  • "iPhone 5" sometimes doesn't wake up when pressing on the start or power buttons

    Hello Everyone,
    I'm facing a little problem with my new iPhone 5.
    When it goes into sleep, sometimes doesn't wake up after pressing on the start or power buttons, and I have to wait 5 to 15 seconds until it is ON again.
    Do you have any idea Why is that?
    Regards,
    William

    Hi William,
    There is a section in this article that troubleshoots when a button is slow to respond:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Specifically, this section:
    Buttons and Switches
    The Home button is slow to respond
    Cheers!
    - Ari

  • Loading .gif animations into Photoshop Elements 8 for Mac

    For years I used Photoshop Elements 2 for Windows to make .gif animations with great success. 
    Then I switched to a Mac and bought Elements 8 for Mac.  Now, I am finding out that I can not load any
    of the animations I made using Elements 2 into 8.  (And yet I can load animations I made using 8 into 2.)
    In fact, I can not load any .gif animations into 8, other than if I make one and save it
    as .psd.  8 allows me to make them, but not load them as .gifs.
    My question:  Is there an easy way to load .gif animations into PS Elements 8 so a
    person can work on the individual frames?  Am I going to have to convert any .gif animation I
    want to import into 8 first into .psd?  All I seem to get when I try to load a .gif is the message
    "This is an animated gif.   You can only view one frame." I have searched manuals and the
    Net looking for a specific method of using PSE8 to load gif animations intact (not just one frame). 
    Is it possible?  Thanks. (I also have noticed that Elements 8 will not allow me to change the frame
    speed -- it is unchangeable at .2)

    Dear Ms. Brundage -
    I followed the directions detailed in your blog entitled "Moving a Catalog from Windows to Mac" as well as your description of the process on page 58 of your book "Photoshop Elements 9 - the missing manual." 
    I installed PE9 for Windows and converted my catalog.  I then backed up that catalog to an external hard drive.  I then connected the hard drive to my MAC on which I also installed Photoshop Elements 9 for MAC.  I opened the Organizer and tried to restore that converted catalog.  However, for each file in the converted catalog, a dialog box opened that said "Could not restore file:  /Volumes/Name of External Hard Drive/Filename.JPG."
    I then made a second backup of the converted catalog using Photoshop Elements 9 for Windows and then tried to restore that catalog again on the MAC using Photoshop Elements 9 for MAC, again to no avail.
    Do you have any idea what the problem may be?
    Thanks again.
    Steve Haas
    [email protected]
    [email protected]
    (770) 313-0038

  • Java_ME_platform_SDK_3.0_EA won't load .gif?

    I've been developing a midp 2.0 program for a couple of months now, in which I'm using both .png and .gif files.
    The other day I switched from SWT 2.5.2 to Java_ME_platform_SDK_3.0_EA, and suddenly a new error occured when I started the program.
    java.io.IOException nullIt seems that now I can no longer load gif's using:
    Image.createImage(fullName);Where fullname is a resouce in the .jar i.e. /org/netbeans/microedition/resources/dir.gif
    There is no doubt that the problem is within SDK3.0, because if I switch to Sony Ericsson, Nokia or SWT 2.5.2 the code runs fine.
    Does anyone know the reason for this? I suspect that it is an actual
    problem that can occur on some devices, as I've seen something similar
    happen when testing on a HTC P3300 smartphone. I've tried the
    application on lots of different Nokia + Sony Ericsson phones without
    problems.
    I've solved the problem by converting all my .gif's to .png's. But now my jar-file has grown 100% :(
    I've also tried to create the image "manually"
               try {
                byte[] bytes = loadImageData(is);
                for (int i = 0; i < bytes.length; i++) {
                    System.out.print(bytes[i] + ",");
                Image img = Image.createImage(bytes, 0, bytes.length);
            } catch (Exception e) {
                System.out.println(e.getMessage());
                e.printStackTrace();
        public byte[] loadImageData(InputStream in) throws IOException {
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            int bs;
            byte[] buffer = new byte[512];
            while ((bs = in.read(buffer)) != -1) {
                bout.write(buffer, 0, bs);
            return bout.toByteArray();
        }Which gives me an IllegalArgumentException (imageData is incorrectly formatted or otherwise cannot be decoded)
    But the bytestream appears to be my gif image:
    71,73,70,56,57,97,16,0,16,0,-9,0,0,0,0,0,-1,-83,25,-1,-20,127,127,0,0,-1,-1,-1,-1,-34,25,-27,49,0,-57,-57,-57,71,71,71,-1,-62,-78,-1,-1,0,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,0,0,0,16,0,16,0,0,8,123,0,9,8,20,8,-96,96,-63,-127,8,9,2,8,-64,-48,32,-128,-124,4,22,50,44,80,48,-128,65,-124,18,5,8,40,-88,81,-128,-59,-121,4,3,8,64,112,-112,-28,-127,-115,32,23,106,60,24,81,1,-127,-107,15,1,104,-92,8,0,65,-60,-102,5,80,70,20,64,115,-32,-63,2,61,101,22,44,-128,-47,97,-52,-115,3,-110,42,85,-70,82,-31,0,3,80,-93,26,24,-80,-47,39,-61,-89,9,-78,78,109,-24,83,-30,-46,1,92,125,-34,100,72,-106,101,87,-93,102,33,-86,-123,24,16,0,59

    Did you check Release Notes of the SDK? I've seen it once - if memory serves it lists quite a lot of known bugs.
    Maybe the problem you describe is listed there too... and if you're really lucky then description may even mention some workaround for it.

  • Compositing in KDE sometimes doesn't work on Nvidia hardware

    I tried searching whether similar issue was already discussed on the forums, but didn't find anything; sorry if I missed it.
    I have two different systems with Nvidia hardware, one with a 9500M GS, and another one with a GTX 580. After updating to KDE 4.11 (as far as I remember, this issue started appearing at about that time; now it still happens with KDE 4.12) compositing in KDE sometimes doesn't work. By "sometimes" I mean that once in a while I boot the computer and compositing isn't working, then I reboot and everything is fine. Sometimes hitting Alt+Shift+F12 twice helps, but sometimes it doesn't. I didn't gather statistics, but it seems to happen on the 9500M GS system more often than on the GTX580 one. On the former it happens once in about three boots, while on the latter it's something like once per ten boots, but I may be wrong.
    I use proprietary driver, since I sometimes use the computer for gaming, and the opensource driver is still not quite up to the task. Btw, games work fine even when compositing doesn't work.
    I haven't noticed any similar issue on my other machine with Intel graphics.
    If anyone could help in identifying the cause, I would be much obliged, because I have no idea where to start searching.

    Good guess but even if I miss the word or any text, in normal use it still brings up the menu (with options limited to 'zoom in' and 'zoom out'). When I'm not getting the menu for word correction I'm not getting any menu in the body of the document at all - it's strange!

  • A little uncanny situation since release of FIREFOX RC is that 'Reload option which used to come under view option is no longer visible,but appears as an icon in toolbar...which sometimes doesn't work'. Please try to fix it if its only my problem

    I have been using FIREFOX since a long time back and am quite happy with FIREFOX 4.
    But a little uncanny situation since release of FIREFOX RC is that 'Reload which used to come under view option is no longer visible,but appears as an icon(button) in toolbar...which sometimes doesn't work(becomes blur and sometimes firefox hangs)'.
    Please try to fix it if its only my problem or include it in next release.Thanks!

    I have been using FIREFOX since a long time back and am quite happy with FIREFOX 4.
    But a little uncanny situation since release of FIREFOX RC is that 'Reload which used to come under view option is no longer visible,but appears as an icon(button) in toolbar...which sometimes doesn't work(becomes blur and sometimes firefox hangs)'.
    Please try to fix it if its only my problem or include it in next release.Thanks!

  • Unload All Modules sometimes doesn't work with LabVIEW

    TestStand's File >> Unload All Modules (and its RunState.Engine.UnloadAllModules() function) sometimes works and sometimes doesn't (with LabVIEW). When it doesn't, I have to quit LabVIEW to make TestStand unload LabVIEW VIs, otherwise I can't edit them.
    Is there an "Unload All Modules" command that works all the time?

    Hm, i assume that you have callbacks defined which do call those modules. Possible callbacks to look first are: SequenceFileLoad/Unload, FrontEndCallback.
    Another possible reason is that there are components running in the LV RTE (runtime engine) calling into the VIs you try to debug/modify in the development environment.
    Can you pinpoint the "lock" to specific sequences/modules? Do they lock only after specific sequences/modules have been executed?
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • The home button of my ipt4g sometimes doesn't work

    the home button of my ipt4g sometimes doesn't work what should i do???

    I have the same proble. I have heard multiple accounts of people going to the apple store with this problem and apple gives tham a brand new ipod.

  • The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    The answer helped me.But still, what are the settings that I have to change for the behavior of the mouse pointer towards finder? Also the mouse pointer sometimes  doesn't accept my command and start clicking itself.what is the problem and how to fix it?

    If the mouse clicks something on its own then it looks like you have a hardware problem with the trackpad or possibly the battery that is right underneath the trackpad.
    I have read that the battery can swell and that would put pressure on the trackpad.

  • I got my iPhone 5 s almost a month ago and updated its iOS but from there on I started having problems, the ph sometimes doesn't respond at all to the touch or apps start to open on their own very rapidly and this continues till it can go no further!

    I got my iPhone 5 almost a month ago and updated its iOS but from there on I started having problems, the ph sometimes doesn't respond at all to the touch or apps start to open on their own very rapidly and this continues till it can go no further!

    First steps in troubleshooting:
    Close all open apps by double-tapping the home button, then swiping up and off the screen with the app window (not the smaller icon).
    Then reset: hold down the home button along with the sleep/wake button until you see the apple, then let go. (No data loss)

  • Delete Record Behavior doesn't wait for Submit button

    I have master / detail page set.  From the detail set there are links to delete or update a record.  When I click the link to delete the record, it goes to the   confirmation page with the correct record.  Now, when I add the delete record server behavior and a submit button, this is what happens.  As soon as I click the link to go to the delete confirm page, the record deletes and the page redirects to the page I put in the server behavior.  It doesn't show the confirm page and doesn't wait for me to hit the confirm button.  The page runs and successfully deletes the page from the DB.
    How do I get it to wait until I hit the submit button?

    You need to surround your delete query with an "If" statement that checks for a confirmation variable of some sort, then when the user clicks the confirmation link you can pass the necessary variable and the ID of the record the delete query is expecting.
    As an alternative you could use a JS alert fuction to ask the user if they are sure they want to delete the record and then allwo the delet to run after confirmation. To do this you could use code like this...
    <input type="submit" name="DELETE" value="DELETE"
       onclick="return confirm('Are you SURE you want to DELETE this record?')">
    Lawrence   *Adobe Community Expert*
    www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in ASP, PHP and CF
    www.twitter.com/LawrenceCramer

Maybe you are looking for

  • Basic questions in SRM for Workflows+need material

    Hi All, I have developed Workflows in SAP R3.I am very new to SRM. I have following questions - 1. What is the use of BADI when we implement Workflow? My understanding till now is to provide all approvers to the    Shooping Cart.That means for workfl

  • Redirect portal users to accept "terms & conditions" ...

    Here is the requirement .. When the users logging in first time i need them redirected to a page to accept "terms and conditions" , next time the page should not be appeared. Only the "terms and conditions" page should be appeared for those who are n

  • On outer Join Query

    Hi All, I have a outer join query which is creating bottlenecks and increasing the cost of the query, the plan of the query is pretty awkward with multiple nested outer loop joins. Though its the requirement for me to write such a query. I would like

  • Integration builder config obj transported from DEV to QA but not found

    Hi, I have a new development in PI DEV. I exported the ESR objects in a transport as well the Integration builder config objects in the same transport. Asked my admin to move it through CTS to PI QA. Its done. In PI QA system, I am able to see the ne

  • Colors are too bright when Indesign CS 5.5 exports .swf

    I created a document in Illustrator and transferred the layers over to InDesign CS 5.5 to make an interactive .swf. The colors stayed the same until I exported the .swf from Indesign and the golden yellows became obnoxiously bright. What's even stran