read this
http://www.w3.org/Graphics/JPEG/jfif3.pdf
Its fairly easy to determine if a file is FIF. Its harder to tell if it is valid (you need to parse the file completely for required markers and ensure they are valid, then examine the data to see if it complies). JPEG streams can be used in a variety of file formats so even if the file is not a FIF it could still be JPEG (i.e. TIFF)
matfud
That's surprising that the whole JVM crashes. I didn't think that was possible. File a bug report, maybe you'll get 5 minutes of fame.
On a serious note:
Is it really crashing the JVM or is it just causing your application to crash?
Can any applications open the JPEG in question?
Here are some bug reports, but it is a bug in progress and fixed only in 1.5
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4836529
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4845461
Is it really crashing the JVM or is it just causing your application to crash?
The whole jvm crahes and brings down the server
Can any applications open the JPEG in question?
No other applications can open the JPEG, it is a corrupt JPEG. Not sure how to identify it though.