I'm using a java program to create thumbnails for online images.
I encountered the following at runtime:
Uncaught error fetching image:
java.lang.SecurityException: image moved!
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at java.lang.SecurityException.<init>(SecurityException.java:39)
at sun.awt.image.URLImageSource.getDecoder(Compiled Code)
at sun.awt.image.InputStreamImageSource.doFetch(Compiled Code)
at sun.awt.image.ImageFetcher.fetchloop(Compiled Code)
at sun.awt.image.ImageFetcher.run(Compiled Code)
Any idea what causes this and how to prevent it?
Thank you.
It would be something in your code, the code you didn't post.
--
Paul Lutus
www.arachnoid.com
public JpegEncoder(Image image, int quality, OutputStream out) throws
Exception
{
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image, 0);
try {
tracker.waitForID(0);
}
catch (InterruptedException e) {;}
.....
It's working fine before tracker.waitForID(0).
How praytell does client code cause a SecurityException in a sun.awt.*
class? Well, the answer is that it doesn't.
If you don't know the answer to a question, or don't want to bother to
spend the five minutes required to investigate the problem, just ignore
the post and move on to the next one. Telling everyone and his brother
that the problem is in their code isn't helpful, and, in this case (and
others), is 100% incorrect.
To the original poster:
This problem occured in Java versions prior to 1.3. The error is in the
URLImageSource.getDecoder() method which was improperly using object
identity (as opposed to String equivalence) to compare host name
Strings. The bug is listed as fixed in version 1.3. I presume that you
are using an older version which is why you are seeing this error.
Jim S.