Solved

Re-loading corrupt images

Posted on 1997-06-26
3
260 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jdbc error in jsp application 20 63
maven module vs maven project 3 46
Running JavaFX on JDeveloper 12C 1 54
What's wrong with this code? 4 26
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

856 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