Program: 28369
Project: 28369
Buggy source:
/** 
 * <p> This method uploads a file temp directory</p> <p> Input value: "file" -- Type: <code>com.sun.webui.jsf.model.UploadedFile</code></p> <p> Output value: "uploadDir" -- Type: <code>java.lang.String</code></p>
 * @param handlerCtx	The HandlerContext.
 */
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=UploadedFile.class)},output={@HandlerOutput(name="String_Node_Str",type=String.class),@HandlerOutput(name="String_Node_Str",type=String.class)}) public static void uploadFileToTempDir(HandlerContext handlerCtx){
  Logger logger=GuiUtil.getLogger();
  if (logger.isLoggable(Level.FINE)) {
    logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
  }
  UploadedFile uploadedFile=(UploadedFile)handlerCtx.getInputValue("String_Node_Str");
  File tmpFile=null;
  String uploadTmpFile="String_Node_Str";
  if (uploadedFile != null) {
    String name=uploadedFile.getOriginalName();
    logger.info("String_Node_Str" + name);
    int lastIndex=name.lastIndexOf("String_Node_Str");
    if (lastIndex != -1) {
      name=name.substring(lastIndex + 1,name.length());
    }
    int index=name.indexOf("String_Node_Str");
    if (index <= 0) {
      logger.info("String_Node_Str" + name + "String_Node_Str"+ index);
      String mesg=GuiUtil.getMessage("String_Node_Str");
      GuiUtil.handleError(handlerCtx,mesg);
      return;
    }
    String suffix=name.substring(index);
    String prefix=name.substring(0,index);
    handlerCtx.setOutputValue("String_Node_Str",prefix);
    try {
      if (prefix.length() <= 2) {
        prefix=prefix + new Random().nextInt(100000);
      }
      tmpFile=File.createTempFile(prefix,suffix);
      tmpFile.deleteOnExit();
      logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
      uploadedFile.write(tmpFile);
      logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
      uploadTmpFile=tmpFile.getCanonicalPath();
    }
 catch (    IOException ioex) {
      try {
        if (tmpFile != null) {
          uploadTmpFile=tmpFile.getAbsolutePath();
        }
      }
 catch (      Exception ex) {
      }
    }
catch (    Exception ex) {
      GuiUtil.handleException(handlerCtx,ex);
    }
  }
  logger.fine(GuiUtil.getCommonMessage("String_Node_Str") + uploadTmpFile);
  handlerCtx.setOutputValue("String_Node_Str",uploadTmpFile);
}

Fixed version (ground truth):
/** 
 * <p> This method uploads a file temp directory</p> <p> Input value: "file" -- Type: <code>com.sun.webui.jsf.model.UploadedFile</code></p> <p> Output value: "uploadDir" -- Type: <code>java.lang.String</code></p>
 * @param handlerCtx	The HandlerContext.
 */
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=UploadedFile.class)},output={@HandlerOutput(name="String_Node_Str",type=String.class),@HandlerOutput(name="String_Node_Str",type=String.class)}) public static void uploadFileToTempDir(HandlerContext handlerCtx){
  Logger logger=GuiUtil.getLogger();
  if (logger.isLoggable(Level.FINE)) {
    logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
  }
  UploadedFile uploadedFile=(UploadedFile)handlerCtx.getInputValue("String_Node_Str");
  File tmpFile=null;
  String uploadTmpFile="String_Node_Str";
  if (uploadedFile != null) {
    String name=uploadedFile.getOriginalName();
    logger.info("String_Node_Str" + name);
    int lastIndex=name.lastIndexOf("String_Node_Str");
    if (lastIndex != -1) {
      name=name.substring(lastIndex + 1,name.length());
    }
    int index=name.indexOf("String_Node_Str");
    if (index <= 0) {
      logger.info("String_Node_Str" + name + "String_Node_Str"+ index);
      String mesg=GuiUtil.getMessage("String_Node_Str");
      GuiUtil.handleError(handlerCtx,mesg);
      return;
    }
    String suffix=name.substring(index);
    String prefix=name.substring(0,index);
    handlerCtx.setOutputValue("String_Node_Str",prefix);
    try {
      if (prefix.length() <= 2) {
        prefix=prefix + new Random().nextInt(100000);
      }
      tmpFile=File.createTempFile(prefix,suffix);
      tmpFile.deleteOnExit();
      if (logger.isLoggable(Level.FINE)) {
        logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
      }
      uploadedFile.write(tmpFile);
      if (logger.isLoggable(Level.FINE)) {
        logger.fine(GuiUtil.getCommonMessage("String_Node_Str"));
      }
      uploadTmpFile=tmpFile.getCanonicalPath();
    }
 catch (    IOException ioex) {
      try {
        if (tmpFile != null) {
          uploadTmpFile=tmpFile.getAbsolutePath();
        }
      }
 catch (      Exception ex) {
      }
    }
catch (    Exception ex) {
      GuiUtil.handleException(handlerCtx,ex);
    }
  }
  if (logger.isLoggable(Level.FINE)) {
    logger.fine(GuiUtil.getCommonMessage("String_Node_Str") + uploadTmpFile);
  }
  handlerCtx.setOutputValue("String_Node_Str",uploadTmpFile);
}