Program: 25095
Project: 25095
Buggy source:
protected void doGetJobParam(UWSUrl requestUrl,HttpServletRequest req,HttpServletResponse resp,JobOwner user) throws UWSException, ServletException, IOException {
  UWSJob job=getJob(requestUrl,user);
  String[] attributes=requestUrl.getAttributes();
  if (attributes[0].equalsIgnoreCase(UWSJob.PARAM_RESULTS) && attributes.length > 1) {
    Result result=job.getResult(attributes[1]);
    if (result == null)     throw new UWSException(UWSException.NOT_FOUND,"String_Node_Str" + attributes[1] + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
 else     if (result.getHref() != null && !result.getHref().trim().isEmpty() && !result.getHref().equalsIgnoreCase(req.getRequestURL().toString()))     redirect(result.getHref(),req,user,UWSAction.GET_JOB_PARAM,resp);
 else {
      InputStream input=null;
      try {
        input=getFileManager().getResultInput(result,job);
        UWSToolBox.write(input,result.getMimeType(),result.getSize(),resp);
      }
 catch (      IOException ioe) {
        getLogger().logUWS(LogLevel.ERROR,result,"String_Node_Str","String_Node_Str" + result.getId() + "String_Node_Str"+ job.getJobId()+ "String_Node_Str",ioe);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,ioe,"String_Node_Str" + result.getId() + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
      }
 finally {
        if (input != null)         input.close();
      }
    }
  }
 else   if (attributes[0].equalsIgnoreCase(UWSJob.PARAM_ERROR_SUMMARY) && attributes.length > 1 && attributes[1].equalsIgnoreCase("String_Node_Str")) {
    ErrorSummary error=job.getErrorSummary();
    if (error == null)     throw new UWSException(UWSException.NOT_FOUND,"String_Node_Str" + job.getJobId() + "String_Node_Str");
 else {
      InputStream input=null;
      try {
        input=getFileManager().getErrorInput(error,job);
        UWSToolBox.write(input,"String_Node_Str",getFileManager().getErrorSize(error,job),resp);
      }
 catch (      IOException ioe) {
        getLogger().logUWS(LogLevel.ERROR,error,"String_Node_Str","String_Node_Str" + job.getJobId() + "String_Node_Str",ioe);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,ioe,"String_Node_Str" + job.getJobId() + "String_Node_Str");
      }
 finally {
        if (input != null)         input.close();
      }
    }
  }
 else {
    UWSSerializer serializer=getSerializer(req.getHeader("String_Node_Str"));
    String uwsField=attributes[0];
    boolean jobSerialization=false;
    if (uwsField == null || uwsField.trim().isEmpty() || (attributes.length <= 1 && (uwsField.equalsIgnoreCase(UWSJob.PARAM_ERROR_SUMMARY) || uwsField.equalsIgnoreCase(UWSJob.PARAM_RESULTS) || uwsField.equalsIgnoreCase(UWSJob.PARAM_PARAMETERS)))) {
      resp.setContentType(serializer.getMimeType());
      jobSerialization=true;
    }
 else     resp.setContentType("String_Node_Str");
    try {
      job.serialize(resp.getOutputStream(),attributes,serializer);
    }
 catch (    Exception e) {
      if (!(e instanceof UWSException)) {
        String errorMsgPart=(jobSerialization ? "String_Node_Str" + job.getJobId() + "String_Node_Str" : "String_Node_Str" + uwsField + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
        getLogger().logUWS(LogLevel.ERROR,requestUrl,"String_Node_Str","String_Node_Str" + errorMsgPart + "String_Node_Str",e);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,e,"String_Node_Str" + errorMsgPart + "String_Node_Str");
      }
 else       throw (UWSException)e;
    }
  }
}

Fixed version (ground truth):
protected void doGetJobParam(UWSUrl requestUrl,HttpServletRequest req,HttpServletResponse resp,JobOwner user) throws UWSException, ServletException, IOException {
  UWSJob job=getJob(requestUrl,user);
  String[] attributes=requestUrl.getAttributes();
  if (attributes[0].equalsIgnoreCase(UWSJob.PARAM_RESULTS) && attributes.length > 1) {
    Result result=job.getResult(attributes[1]);
    if (result == null)     throw new UWSException(UWSException.NOT_FOUND,"String_Node_Str" + attributes[1] + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
 else     if (result.getHref() != null && !result.getHref().trim().isEmpty() && !result.getHref().equalsIgnoreCase(req.getRequestURL().toString()))     redirect(result.getHref(),req,user,UWSAction.GET_JOB_PARAM,resp);
 else {
      InputStream input=null;
      try {
        input=getFileManager().getResultInput(result,job);
        UWSToolBox.write(input,result.getMimeType(),result.getSize(),resp);
      }
 catch (      IOException ioe) {
        getLogger().logUWS(LogLevel.ERROR,result,"String_Node_Str","String_Node_Str" + result.getId() + "String_Node_Str"+ job.getJobId()+ "String_Node_Str",ioe);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,ioe,"String_Node_Str" + result.getId() + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
      }
 finally {
        if (input != null)         input.close();
      }
    }
  }
 else   if (attributes[0].equalsIgnoreCase(UWSJob.PARAM_ERROR_SUMMARY) && attributes.length > 1 && attributes[1].equalsIgnoreCase("String_Node_Str")) {
    ErrorSummary error=job.getErrorSummary();
    if (error == null)     throw new UWSException(UWSException.NOT_FOUND,"String_Node_Str" + job.getJobId() + "String_Node_Str");
 else {
      InputStream input=null;
      try {
        input=getFileManager().getErrorInput(error,job);
        UWSToolBox.write(input,errorWriter.getErrorDetailsMIMEType(),getFileManager().getErrorSize(error,job),resp);
      }
 catch (      IOException ioe) {
        getLogger().logUWS(LogLevel.ERROR,error,"String_Node_Str","String_Node_Str" + job.getJobId() + "String_Node_Str",ioe);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,ioe,"String_Node_Str" + job.getJobId() + "String_Node_Str");
      }
 finally {
        if (input != null)         input.close();
      }
    }
  }
 else {
    UWSSerializer serializer=getSerializer(req.getHeader("String_Node_Str"));
    String uwsField=attributes[0];
    boolean jobSerialization=false;
    if (uwsField == null || uwsField.trim().isEmpty() || (attributes.length <= 1 && (uwsField.equalsIgnoreCase(UWSJob.PARAM_ERROR_SUMMARY) || uwsField.equalsIgnoreCase(UWSJob.PARAM_RESULTS) || uwsField.equalsIgnoreCase(UWSJob.PARAM_PARAMETERS)))) {
      resp.setContentType(serializer.getMimeType());
      jobSerialization=true;
    }
 else     resp.setContentType("String_Node_Str");
    try {
      job.serialize(resp.getOutputStream(),attributes,serializer);
    }
 catch (    Exception e) {
      if (!(e instanceof UWSException)) {
        String errorMsgPart=(jobSerialization ? "String_Node_Str" + job.getJobId() + "String_Node_Str" : "String_Node_Str" + uwsField + "String_Node_Str"+ job.getJobId()+ "String_Node_Str");
        getLogger().logUWS(LogLevel.ERROR,requestUrl,"String_Node_Str","String_Node_Str" + errorMsgPart + "String_Node_Str",e);
        throw new UWSException(UWSException.INTERNAL_SERVER_ERROR,e,"String_Node_Str" + errorMsgPart + "String_Node_Str");
      }
 else       throw (UWSException)e;
    }
  }
}