Solved

Re-loading corrupt images

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 39
groupSumClump challenge 9 102
topping2 challenge 13 83
HTTPSessionBindingListernter not configured in deployment descriptor 2 38
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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:

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now