Program: 65585
Project: 65585
Buggy source:
/** 
 * Gets the embedded image
 * @param embeddedImage the embedded image data
 * @return Returns the image,or null if the embedded image doesn't exist.
 */
public Image getEmbeddedImage(ModuleHandle handle,String name){
  String key=generateKey(handle,name);
  EmbeddedImage embeddedImage=handle.findImage(name);
  if (embeddedImage == null) {
    removeCachedImage(key);
    return null;
  }
  Image image=getImageRegistry().get(key);
  if (image != null) {
    return image;
  }
  InputStream in=null;
  try {
    if (key.toLowerCase().endsWith("String_Node_Str")) {
      JPEGTranscoder transcoder=new JPEGTranscoder();
      transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(.8));
      TranscoderInput input=new TranscoderInput(new ByteArrayInputStream(embeddedImage.getData(handle.getModule())));
      input.setURI(generateURL(handle,handle.getFileName()).toString());
      ByteArrayOutputStream ostream=new ByteArrayOutputStream();
      TranscoderOutput output=new TranscoderOutput(ostream);
      try {
        transcoder.transcode(input,output);
      }
 catch (      TranscoderException e) {
      }
      ostream.flush();
      in=new ByteArrayInputStream(ostream.toByteArray());
    }
 else {
      in=new ByteArrayInputStream(embeddedImage.getData(handle.getModule()));
    }
    image=new Image(null,in);
  }
 catch (  Exception e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
  }
  if (image != null) {
    getImageRegistry().put(key,image);
    if (DesignerConstants.TRACING_IMAGE_MANAGER_IMAGE_ADD) {
      System.out.println("String_Node_Str" + key + "String_Node_Str");
    }
  }
  return image;
}

Fixed version (ground truth):
/** 
 * Gets the embedded image
 * @param embeddedImage the embedded image data
 * @return Returns the image,or null if the embedded image doesn't exist.
 */
public Image getEmbeddedImage(ModuleHandle handle,String name){
  String key=generateKey(handle,name);
  EmbeddedImage embeddedImage=handle.findImage(name);
  if (embeddedImage == null) {
    removeCachedImage(key);
    return null;
  }
  Image image=getImageRegistry().get(key);
  if (image != null) {
    return image;
  }
  InputStream in=null;
  try {
    if (key.toLowerCase().endsWith("String_Node_Str")) {
      JPEGTranscoder transcoder=new JPEGTranscoder();
      transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new Float(.8));
      TranscoderInput input=new TranscoderInput(new ByteArrayInputStream(embeddedImage.getData(handle.getModule())));
      input.setURI(generateURL(handle,handle.getFileName()).toString());
      ByteArrayOutputStream ostream=new ByteArrayOutputStream();
      TranscoderOutput output=new TranscoderOutput(ostream);
      try {
        transcoder.transcode(input,output);
      }
 catch (      TranscoderException e) {
      }
      ostream.flush();
      in=new ByteArrayInputStream(ostream.toByteArray());
    }
 else {
      in=new ByteArrayInputStream(embeddedImage.getData(handle.getModule()));
    }
    ImageData[] datas=new ImageLoader().load(in);
    if (datas != null && datas.length != 0) {
      ImageData cur=null;
      int index=0;
      for (int i=0; i < datas.length; i++) {
        ImageData temp=datas[i];
        if (temp.width * temp.height > datas[index].width * datas[index].height) {
          index=i;
        }
      }
      cur=datas[index];
      image=new Image(null,cur);
    }
  }
 catch (  Exception e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
  }
  if (image != null) {
    getImageRegistry().put(key,image);
    if (DesignerConstants.TRACING_IMAGE_MANAGER_IMAGE_ADD) {
      System.out.println("String_Node_Str" + key + "String_Node_Str");
    }
  }
  return image;
}