Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Why does the following code generate a NullPointerException?
public class SimpleApplet extends java.applet.Applet {
java.awt.Image art;
public void init() {
art = getImage(getDocumentBase(), getParameter("img"));
}
public void paint(java.awt.Graphics g) {
g.drawImage(art, 0, 0, this);
}
}
Because art is null.
There is a race-condition (threading) bug in some older applet environments (the JVM and the browser) such that an Applet's
paint() method can be called before its init() method. The workaround (aside from updating your environment) is to add if (art != null) before the call to drawImage(). Once init() is called, the subsequent calls to paint() will work properly.
Of course, you'll need to make sure that SimpleApplet can find the image file; make sure getDocumentBase() returns a valid URL, and that the HTML page is set up correctly (so that getParameter() returns a valid image-file name).