Solved

Re-loading corrupt images

Posted on 1997-06-26
3
261 Views
Last Modified: 2006-11-17
I am using MediaTracker to keep track of the loading status of some images that I need for my applet. Even though all images are completely and correctly in the browsers cache (check with about:cache), MediaTracker.isErrorAny() and getErrorsAny() will return true (I am using a separate MediaTracker for each image, so I think using the Any-functions is not the problem :).

The Image objects that I try to load the pictures in will be (null).

The really strange things is that when you start the applet again (without flushing the cache), the pictures MAY load.

Whats going wrong here?

Netscape 3/4 and MSIE behave the same way on Win95/NT.
0
Comment
Question by:intouch_chris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:mann061997
ID: 1222299
Did you call one of the waitFor...() methods before
accessing the images?

0
 

Author Comment

by:intouch_chris
ID: 1222300
Yes, I made a call to waitForAll() and it returns without any Exceptions...
0
 
LVL 3

Accepted Solution

by:
garik earned 200 total points
ID: 1222301
I can't reproduce this error now, but I remember having exactly the same problem. That's why I'm using while() loop in my applets:

while ((m_Tracker.statusID(id, true) & m_Tracker.COMPLETE) == 0)
{
  try {
    m_Tracker.waitForID(id);
  } catch (InterruptedException e) {}
}

There was a time when I had this problem persistently: MediaTracker would indicate an error on a first run, but the second (or third?) would complete normally. I gave up on figuring out the reason and using this loop since then. You might want to add cycle counter to get out of the loop when there is a real error, but give it 3-4 spins - I'm pretty sure your problem will go away.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
even odd program using while loop 3 74
servlet web applications   metadata-complete="true" or false 3 201
Java basic valueOf question 1 35
Java program running SQL query 5 50
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question