Solved

Re-loading corrupt images

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 37
xampp tool 12 51
Chrome and Firefox Java 5 34
Html Table Looping (part 2) 5 8
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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…

803 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