Buggy code:
public class KittenCaptchaPanel extends Panel { private static final long serialVersionUID = 2711167040323855070L ; private static BufferedImage grass = KittenCaptchaPanel . load ( "images//grass.png" ) ; private static final List < KittenCaptchaPanel . Animal > kittens = new ArrayList < KittenCaptchaPanel . Animal > ( ) ; private static final List < KittenCaptchaPanel . Animal > nonKittens = new ArrayList < KittenCaptchaPanel . Animal > ( ) ; private static Random random = new Random ( ( - 1 ) ) ; private static BufferedImage load ( final String filename ) { } private final KittenCaptchaPanel . PlacedAnimalList animals ; private final Label animalSelectionLabel ; private final Image image ; private final KittenCaptchaPanel . CaptchaImageResource imageResource ; private final Dimension imageSize ; public KittenCaptchaPanel ( final String id , final Dimension imageSize ) { } public boolean allKittensSelected ( ) { } public void reset ( ) { } private KittenCaptchaPanel . PlacedAnimal placeAnimal ( final List < KittenCaptchaPanel . PlacedAnimal > animals , final KittenCaptchaPanel . Animal newAnimal ) { } private int random ( final int max ) { } private KittenCaptchaPanel . Animal randomKitten ( ) { } private KittenCaptchaPanel . Animal randomNonKitten ( ) { } private static class Animal { private final BufferedImage highlightedImage ; private final BufferedImage image ; private final boolean isKitten ; private final OpaqueRegion visibleRegion ; private Animal ( final String filename , final boolean isKitten ) { } private BufferedImage load ( final String filename ) { } } private class CaptchaImageResource extends DynamicImageResource { private static final long serialVersionUID = - 1560784998742404278L ; private final KittenCaptchaPanel . PlacedAnimalList animals ; private transient SoftReference < byte [ ] > data = null ; @ Override protected void configureResponse ( ResourceResponse response , Attributes attributes ) { super . configureResponse ( response , attributes ) ; <START_BUG> response . setCacheDuration ( MAX_CACHE_DURATION ) ; <END_BUG> } private CaptchaImageResource ( final KittenCaptchaPanel . PlacedAnimalList animals ) { } @ Override protected byte [ ] getImageData ( Attributes attributes ) { } protected void invalidate ( ) { } private boolean allKittensSelected ( ) { } private void clearData ( ) { } private void reset ( ) { } private String selectString ( ) { } } private class PlacedAnimal implements Serializable { private static final long serialVersionUID = - 6703909440564862486L ; private transient KittenCaptchaPanel . Animal animal ; private final int index ; private boolean isHighlighted ; private final boolean isKitten ; private final Point location ; private final float [ ] scales = new float [ ] { 1.0F , 1.0F , 1.0F , 1.0F } ; public PlacedAnimal ( final KittenCaptchaPanel . Animal animal , final Point location ) { } @ Override public String toString ( ) { } private boolean contains ( final Point point ) { } private void draw ( final Graphics2D graphics ) { } private KittenCaptchaPanel . Animal getAnimal ( ) { } private float random ( float min , float max ) { } } private class PlacedAnimalList implements Serializable { private static final long serialVersionUID = 6335852594326213439L ; private final List < KittenCaptchaPanel . PlacedAnimal > animals = new ArrayList < KittenCaptchaPanel . PlacedAnimal > ( ) ; private PlacedAnimalList ( ) { } private boolean allKittensSelected ( ) { } private KittenCaptchaPanel . PlacedAnimal atLocation ( final Point location ) { } private BufferedImage createImage ( ) { } private void reset ( ) { } private String selectString ( ) { } private OpaqueRegion visibleRegion ( final KittenCaptchaPanel . PlacedAnimal animal ) { } } }

Fix:
response . setCacheDuration ( Integer . MAX_VALUE ) ;