nus-yam/ex-repair huggingface dataset:
Program: 28741
Project: 28741
Buggy source:
public static Vector getPossibleCmpCmrFields(ClassLoader cl,String className) throws Exception {
  Vector fieldDescriptors=new Vector();
  Class theClass=cl.loadClass(className);
  Method[] methods=theClass.getMethods();
  for (int mIndex=0; mIndex < methods.length; mIndex++) {
    Method next=methods[mIndex];
    String nextName=next.getName();
    int nextModifiers=next.getModifiers();
    if (Modifier.isAbstract(nextModifiers)) {
      if (nextName.startsWith(FIELD_ACCESS_METHOD_PREFIX) && nextName.length() > 3) {
        String field=nextName.substring(3,4).toLowerCase() + nextName.substring(4);
        fieldDescriptors.add(new FieldDescriptor(field));
      }
    }
  }
  return fieldDescriptors;
}

Fixed version (ground truth):
public static Vector getPossibleCmpCmrFields(ClassLoader cl,String className) throws Exception {
  Vector fieldDescriptors=new Vector();
  Class theClass=cl.loadClass(className);
  Method[] methods=theClass.getMethods();
  for (int mIndex=0; mIndex < methods.length; mIndex++) {
    Method next=methods[mIndex];
    String nextName=next.getName();
    int nextModifiers=next.getModifiers();
    if (Modifier.isAbstract(nextModifiers)) {
      if (nextName.startsWith(FIELD_ACCESS_METHOD_PREFIX) && nextName.length() > 3) {
        String field=nextName.substring(3,4).toLowerCase(Locale.US) + nextName.substring(4);
        fieldDescriptors.add(new FieldDescriptor(field));
      }
    }
  }
  return fieldDescriptors;
}
Program: 28742
Project: 28742
Buggy source:
public String getCMRFieldReturnType(String field){
  String returnType="String_Node_Str";
  try {
    if (!field.trim().equals("String_Node_Str")) {
      Class persClass=getPersistentClass();
      String methodName="String_Node_Str" + field.substring(0,1).toUpperCase() + field.substring(1);
      Method method=TypeUtil.getMethod(persClass,persClass.getClassLoader(),methodName,new String[]{});
      returnType=method.getReturnType().getName();
    }
  }
 catch (  Throwable t) {
    if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
      DOLUtils.getDefaultLogger().log(Level.FINE,t.toString(),t);
    }
  }
  return returnType;
}

Fixed version (ground truth):
public String getCMRFieldReturnType(String field){
  String returnType="String_Node_Str";
  try {
    if (!field.trim().equals("String_Node_Str")) {
      Class persClass=getPersistentClass();
      String methodName="String_Node_Str" + field.substring(0,1).toUpperCase(Locale.US) + field.substring(1);
      Method method=TypeUtil.getMethod(persClass,persClass.getClassLoader(),methodName,new String[]{});
      returnType=method.getReturnType().getName();
    }
  }
 catch (  Throwable t) {
    if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
      DOLUtils.getDefaultLogger().log(Level.FINE,t.toString(),t);
    }
  }
  return returnType;
}
Program: 28743
Project: 28743
Buggy source:
private synchronized String getLinuxDMIInfo(String dmiType,String target){
  if (dmiInfo == null) {
    Thread dmidecodeThread=new Thread(){
      public void run(){
        dmiInfo=getCommandOutput("String_Node_Str");
      }
    }
;
    dmidecodeThread.start();
    try {
      dmidecodeThread.join(3000);
      if (dmidecodeThread.isAlive()) {
        dmidecodeThread.interrupt();
        dmiInfo="String_Node_Str";
      }
    }
 catch (    InterruptedException ie) {
      dmidecodeThread.interrupt();
    }
  }
  if (dmiInfo.length() == 0) {
    return "String_Node_Str";
  }
  boolean dmiFlag=false;
  for (  String s : dmiInfo.split("String_Node_Str")) {
    String line=s.toLowerCase();
    if (dmiFlag) {
      if (line.contains(target)) {
        String key=target + "String_Node_Str";
        int indx=line.indexOf(key) + key.length();
        if (line.contains(key) && indx < line.length()) {
          return line.substring(indx).trim();
        }
        String[] ss=line.split("String_Node_Str");
        return ss[ss.length - 1];
      }
    }
 else     if (line.contains(dmiType)) {
      dmiFlag=true;
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
private synchronized String getLinuxDMIInfo(String dmiType,String target){
  if (dmiInfo == null) {
    Thread dmidecodeThread=new Thread(){
      public void run(){
        dmiInfo=getCommandOutput("String_Node_Str");
      }
    }
;
    dmidecodeThread.start();
    try {
      dmidecodeThread.join(3000);
      if (dmidecodeThread.isAlive()) {
        dmidecodeThread.interrupt();
        dmiInfo="String_Node_Str";
      }
    }
 catch (    InterruptedException ie) {
      dmidecodeThread.interrupt();
    }
  }
  if (dmiInfo.length() == 0) {
    return "String_Node_Str";
  }
  boolean dmiFlag=false;
  for (  String s : dmiInfo.split("String_Node_Str")) {
    String line=s.toLowerCase(Locale.US);
    if (dmiFlag) {
      if (line.contains(target)) {
        String key=target + "String_Node_Str";
        int indx=line.indexOf(key) + key.length();
        if (line.contains(key) && indx < line.length()) {
          return line.substring(indx).trim();
        }
        String[] ss=line.split("String_Node_Str");
        return ss[ss.length - 1];
      }
    }
 else     if (line.contains(dmiType)) {
      dmiFlag=true;
    }
  }
  return "String_Node_Str";
}
Program: 28744
Project: 28744
Buggy source:
private String getSmbiosData(String type,String target){
  String output=getCommandOutput("String_Node_Str","String_Node_Str",type);
  for (  String s : output.split("String_Node_Str")) {
    if (s.contains(target)) {
      int indx=s.indexOf(target) + target.length();
      if (indx < s.length()) {
        String tmp=s.substring(indx).trim();
        String lowerCaseStr=tmp.toLowerCase();
        if (!lowerCaseStr.startsWith("String_Node_Str") && !lowerCaseStr.startsWith("String_Node_Str")) {
          return tmp;
        }
      }
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
private String getSmbiosData(String type,String target){
  String output=getCommandOutput("String_Node_Str","String_Node_Str",type);
  for (  String s : output.split("String_Node_Str")) {
    if (s.contains(target)) {
      int indx=s.indexOf(target) + target.length();
      if (indx < s.length()) {
        String tmp=s.substring(indx).trim();
        String lowerCaseStr=tmp.toLowerCase(Locale.US);
        if (!lowerCaseStr.startsWith("String_Node_Str") && !lowerCaseStr.startsWith("String_Node_Str")) {
          return tmp;
        }
      }
    }
  }
  return "String_Node_Str";
}
Program: 28745
Project: 28745
Buggy source:
private String getFullWmicResult(String alias,String verb,String property){
  StringBuilder res=new StringBuilder();
  BufferedReader in=null;
  BufferedWriter bw=null;
  try {
    ProcessBuilder pb=new ProcessBuilder("String_Node_Str","String_Node_Str","String_Node_Str",alias,verb,property);
    Process p=pb.start();
    bw=new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
    bw.write(13);
    bw.flush();
    p.waitFor();
    if (p.exitValue() == 0) {
      in=new BufferedReader(new InputStreamReader(p.getInputStream()));
      String line=null;
      while ((line=in.readLine()) != null) {
        line=line.trim();
        if (line.length() == 0) {
          continue;
        }
        if (line.toLowerCase().indexOf(property.toLowerCase()) != -1) {
          continue;
        }
        res.append(line).append("String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return res.toString();
}

Fixed version (ground truth):
private String getFullWmicResult(String alias,String verb,String property){
  StringBuilder res=new StringBuilder();
  BufferedReader in=null;
  BufferedWriter bw=null;
  try {
    ProcessBuilder pb=new ProcessBuilder("String_Node_Str","String_Node_Str","String_Node_Str",alias,verb,property);
    Process p=pb.start();
    bw=new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
    bw.write(13);
    bw.flush();
    p.waitFor();
    if (p.exitValue() == 0) {
      in=new BufferedReader(new InputStreamReader(p.getInputStream()));
      String line=null;
      while ((line=in.readLine()) != null) {
        line=line.trim();
        if (line.length() == 0) {
          continue;
        }
        if (line.toLowerCase(Locale.US).indexOf(property.toLowerCase()) != -1) {
          continue;
        }
        res.append(line).append("String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return res.toString();
}
Program: 28746
Project: 28746
Buggy source:
protected String getCanonicalHost(){
  if (canonicalHostCache == null) {
    try {
      InetAddress address=InetAddress.getByName(host);
      canonicalHostCache=address.getCanonicalHostName();
    }
 catch (    UnknownHostException ex) {
      canonicalHostCache=host;
      if (canonicalHostCache != null) {
        canonicalHostCache=canonicalHostCache.trim().toLowerCase();
      }
    }
  }
  return canonicalHostCache;
}

Fixed version (ground truth):
protected String getCanonicalHost(){
  if (canonicalHostCache == null) {
    try {
      InetAddress address=InetAddress.getByName(host);
      canonicalHostCache=address.getCanonicalHostName();
    }
 catch (    UnknownHostException ex) {
      canonicalHostCache=host;
      if (canonicalHostCache != null) {
        canonicalHostCache=canonicalHostCache.trim().toLowerCase(Locale.US);
      }
    }
  }
  return canonicalHostCache;
}
Program: 28747
Project: 28747
Buggy source:
public long convert(String input){
  String period=input.substring(0,input.length() - 1);
  Long timeInterval=new Long(period);
  String s=input.toLowerCase();
  long milliseconds=86400000;
  if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 1000;
  }
 else   if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 3600 * 1000;
  }
 else   if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 60 * 1000;
  }
  return milliseconds;
}

Fixed version (ground truth):
public long convert(String input){
  String period=input.substring(0,input.length() - 1);
  Long timeInterval=new Long(period);
  String s=input.toLowerCase(Locale.US);
  long milliseconds=86400000;
  if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 1000;
  }
 else   if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 3600 * 1000;
  }
 else   if (s.indexOf("String_Node_Str") > 0) {
    milliseconds=timeInterval * 60 * 1000;
  }
  return milliseconds;
}
Program: 28750
Project: 28750
Buggy source:
public static void logTimingMessage(String msg){
  RestLogging.restLogger.log(Level.INFO,RestLogging.TIMESTAMP_MESSAGE,new Object[]{DATE_FORMAT.format(new Date()),msg});
}

Fixed version (ground truth):
public static void logTimingMessage(String msg){
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  RestLogging.restLogger.log(Level.INFO,RestLogging.TIMESTAMP_MESSAGE,new Object[]{sdf.format(new Date()),msg});
}
Program: 28751
Project: 28751
Buggy source:
public boolean isSet(String fieldName){
  return setFields.contains(fieldName.toLowerCase());
}

Fixed version (ground truth):
public boolean isSet(String fieldName){
  return setFields.contains(fieldName.toLowerCase(Locale.US));
}
Program: 28752
Project: 28752
Buggy source:
public void fieldSet(String fieldName){
  setFields.add(fieldName.toLowerCase());
}

Fixed version (ground truth):
public void fieldSet(String fieldName){
  setFields.add(fieldName.toLowerCase(Locale.US));
}
Program: 28753
Project: 28753
Buggy source:
public String toXML(){
  try {
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document d=db.newDocument();
    Element result=d.createElement("String_Node_Str");
    result.setAttribute("String_Node_Str","String_Node_Str" + recordNumber);
    result.setAttribute("String_Node_Str","String_Node_Str" + loggedDateTime.getTime());
    result.setAttribute("String_Node_Str",loggedLevel);
    result.setAttribute("String_Node_Str",productName);
    result.setAttribute("String_Node_Str",loggerName);
    result.setAttribute("String_Node_Str",nameValuePairs);
    result.setAttribute("String_Node_Str",messageID);
    result.setNodeValue(message);
    d.appendChild(result);
    return xmlToString(d);
  }
 catch (  ParserConfigurationException pex) {
    throw new RuntimeException(pex);
  }
}

Fixed version (ground truth):
public String toXML(){
  try {
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document d=db.newDocument();
    Element result=d.createElement("String_Node_Str");
    result.setAttribute("String_Node_Str","String_Node_Str" + recordNumber);
    result.setAttribute("String_Node_Str",(loggedDateTime != null) ? ("String_Node_Str" + loggedDateTime.getTime()) : "String_Node_Str");
    result.setAttribute("String_Node_Str",loggedLevel);
    result.setAttribute("String_Node_Str",productName);
    result.setAttribute("String_Node_Str",loggerName);
    result.setAttribute("String_Node_Str",nameValuePairs);
    result.setAttribute("String_Node_Str",messageID);
    result.setNodeValue(message);
    d.appendChild(result);
    return xmlToString(d);
  }
 catch (  ParserConfigurationException pex) {
    throw new RuntimeException(pex);
  }
}
Program: 28754
Project: 28754
Buggy source:
public String toJSON(){
  JSONObject obj=new JSONObject();
  try {
    obj.put("String_Node_Str",recordNumber);
    obj.put("String_Node_Str",loggedDateTime.getTime());
    obj.put("String_Node_Str",loggedLevel);
    obj.put("String_Node_Str",productName);
    obj.put("String_Node_Str",loggerName);
    obj.put("String_Node_Str",nameValuePairs);
    obj.put("String_Node_Str",messageID);
    obj.put("String_Node_Str",message);
  }
 catch (  JSONException ex) {
    RestLogging.restLogger.log(Level.SEVERE,null,ex);
  }
  return obj.toString();
}

Fixed version (ground truth):
public String toJSON(){
  JSONObject obj=new JSONObject();
  try {
    obj.put("String_Node_Str",recordNumber);
    obj.put("String_Node_Str",(loggedDateTime != null) ? loggedDateTime.getTime() : null);
    obj.put("String_Node_Str",loggedLevel);
    obj.put("String_Node_Str",productName);
    obj.put("String_Node_Str",loggerName);
    obj.put("String_Node_Str",nameValuePairs);
    obj.put("String_Node_Str",messageID);
    obj.put("String_Node_Str",message);
  }
 catch (  JSONException ex) {
    RestLogging.restLogger.log(Level.SEVERE,null,ex);
  }
  return obj.toString();
}
Program: 28755
Project: 28755
Buggy source:
@GET @Path("String_Node_Str") public String getSchema1() throws JAXBException, IOException {
  Set<Class<?>> classes=new TreeSet<Class<?>>(new Comparator<Class<?>>(){
    @Override public int compare(    Class<?> t,    Class<?> t1){
      return t.getName().compareTo(t1.getName());
    }
  }
);
  try {
    Class<?> modelClass=loadClass("String_Node_Str");
    classes.add(getCompositeUtil().getModel(modelClass).getClass());
    modelClass=loadClass("String_Node_Str");
    classes.add(getCompositeUtil().getModel(modelClass).getClass());
  }
 catch (  ClassNotFoundException ex) {
    RestLogging.restLogger.log(Level.WARNING,null,ex);
  }
  JAXBContext jc=JAXBContext.newInstance(classes.toArray(new Class<?>[]{}));
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  jc.generateSchema(new MySchemaOutputResolver(baos));
  return new String(baos.toByteArray());
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public String getSchema1() throws JAXBException, IOException {
  Set<Class<?>> classes=new TreeSet<Class<?>>(new Comparator<Class<?>>(){
    @Override public int compare(    Class<?> t,    Class<?> t1){
      return t.getName().compareTo(t1.getName());
    }
  }
);
  try {
    Class<?> modelClass=loadClass("String_Node_Str");
    classes.add(getCompositeUtil().getModel(modelClass).getClass());
    modelClass=loadClass("String_Node_Str");
    classes.add(getCompositeUtil().getModel(modelClass).getClass());
  }
 catch (  ClassNotFoundException ex) {
    RestLogging.restLogger.log(Level.WARNING,null,ex);
  }
  JAXBContext jc=JAXBContext.newInstance(classes.toArray(new Class<?>[classes.size()]));
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  jc.generateSchema(new MySchemaOutputResolver(baos));
  return new String(baos.toByteArray());
}
Program: 28756
Project: 28756
Buggy source:
@GET @Path("String_Node_Str") public String getSchema() throws JAXBException, IOException {
  Set<Class<?>> classes=new TreeSet<Class<?>>(new Comparator<Class<?>>(){
    @Override public int compare(    Class<?> t,    Class<?> t1){
      return t.getName().compareTo(t1.getName());
    }
  }
);
  for (  String c : locateRestModels()) {
    try {
      Class<?> modelClass=loadClass(c);
      if (modelClass.getSimpleName().charAt(0) < 'C') {
        classes.add(getCompositeUtil().getModel(modelClass).getClass());
      }
    }
 catch (    ClassNotFoundException ex) {
      RestLogging.restLogger.log(Level.WARNING,null,ex);
    }
  }
  JAXBContext jc=JAXBContext.newInstance(classes.toArray(new Class<?>[]{}));
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  jc.generateSchema(new MySchemaOutputResolver(baos));
  return new String(baos.toByteArray());
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public String getSchema() throws JAXBException, IOException {
  Set<Class<?>> classes=new TreeSet<Class<?>>(new Comparator<Class<?>>(){
    @Override public int compare(    Class<?> t,    Class<?> t1){
      return t.getName().compareTo(t1.getName());
    }
  }
);
  for (  String c : locateRestModels()) {
    try {
      Class<?> modelClass=loadClass(c);
      if (modelClass.getSimpleName().charAt(0) < 'C') {
        classes.add(getCompositeUtil().getModel(modelClass).getClass());
      }
    }
 catch (    ClassNotFoundException ex) {
      RestLogging.restLogger.log(Level.WARNING,null,ex);
    }
  }
  JAXBContext jc=JAXBContext.newInstance(classes.toArray(new Class<?>[classes.size()]));
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  jc.generateSchema(new MySchemaOutputResolver(baos));
  return new String(baos.toByteArray());
}
Program: 28757
Project: 28757
Buggy source:
/** 
 * It is **Essential** to delete this file!  Other code will assume the server is running if it exists. Any old App is currently (10/10/10) allowed to add a shutdownhook with a System.exit() which is GUARANTEED to prevent the shutdown hook for deleting the pidfile to run. So -- we always do it BEFORE trying to exit.
 */
private void deletePidFile(ServerEnvironment env){
  File pidFile=new File(env.getConfigDirPath(),"String_Node_Str");
  if (pidFile.isFile())   pidFile.delete();
}

Fixed version (ground truth):
/** 
 * It is **Essential** to delete this file!  Other code will assume the server is running if it exists. Any old App is currently (10/10/10) allowed to add a shutdownhook with a System.exit() which is GUARANTEED to prevent the shutdown hook for deleting the pidfile to run. So -- we always do it BEFORE trying to exit.
 */
private void deletePidFile(ServerEnvironment env){
  File pidFile=new File(env.getConfigDirPath(),"String_Node_Str");
  if (pidFile.isFile())   FileUtils.deleteFileNowOrLater(pidFile);
}
Program: 28758
Project: 28758
Buggy source:
public static Job constructJobModel(Map<String,Object> jobMap){
  if (jobMap == null) {
    return null;
  }
  Job model=CompositeUtil.instance().getModel(Job.class);
  model.setJobId((String)jobMap.get(ListJobsCommand.ID));
  model.setJobName((String)jobMap.get(ListJobsCommand.NAME));
  model.setExecutionDate(jobMap.get(ListJobsCommand.DATE).toString());
  model.setExitCode((String)jobMap.get(ListJobsCommand.CODE));
  model.setMessage((String)jobMap.get(ListJobsCommand.MESSAGE));
  model.setUser((String)jobMap.get(ListJobsCommand.USER));
  return model;
}

Fixed version (ground truth):
public static Job constructJobModel(Map<String,Object> jobMap){
  if (jobMap == null) {
    return null;
  }
  Job model=CompositeUtil.instance().getModel(Job.class);
  model.setJobId((String)jobMap.get(ListJobsCommand.ID));
  model.setJobName((String)jobMap.get(ListJobsCommand.NAME));
  model.setExecutionDate(jobMap.get(ListJobsCommand.DATE).toString());
  model.setJobState(jobMap.get(ListJobsCommand.STATE).toString());
  model.setExitCode((String)jobMap.get(ListJobsCommand.CODE));
  model.setMessage((String)jobMap.get(ListJobsCommand.MESSAGE));
  model.setUser((String)jobMap.get(ListJobsCommand.USER));
  return model;
}
Program: 28759
Project: 28759
Buggy source:
@Override public void complete(ActionReport report,Payload.Outbound outbound){
  if (commandProgress != null && report != null && report.getActionExitCode() == ExitCode.SUCCESS) {
    commandProgress.complete();
  }
  this.payload=outbound;
  JobPersistence jobPersistenceService=null;
  if (isManagedJob) {
    if (scope != null) {
      jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistence.class,scope + "String_Node_Str");
    }
 else {
      jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistenceService.class);
    }
    List<String> userList=SubjectUtil.getUsernamesFromSubject(subject);
    jobPersistenceService.persist(new JobInfo(id,commandName,executionDate,State.COMPLETED.name(),userList.get(0),report.getMessage(),getJobsFile()));
  }
  complete(report);
}

Fixed version (ground truth):
@Override public void complete(ActionReport report,Payload.Outbound outbound){
  if (commandProgress != null && report != null && report.getActionExitCode() == ExitCode.SUCCESS) {
    commandProgress.complete();
  }
  this.payload=outbound;
  JobPersistence jobPersistenceService=null;
  if (isManagedJob) {
    if (scope != null) {
      jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistence.class,scope + "String_Node_Str");
    }
 else {
      jobPersistenceService=Globals.getDefaultHabitat().getService(JobPersistenceService.class);
    }
    List<String> userList=SubjectUtil.getUsernamesFromSubject(subject);
    jobPersistenceService.persist(new JobInfo(id,commandName,executionDate,report.getActionExitCode().name(),userList.get(0),report.getMessage(),getJobsFile(),State.COMPLETED.name()));
  }
  complete(report);
}
Program: 28760
Project: 28760
Buggy source:
/** 
 * This will return a list of jobs which have crossed the JOBS_RETENTION_PERIOD and need to be purged
 * @return  list of jobs to be purged
 */
public synchronized ArrayList<JobInfo> getExpiredJobs(){
  ArrayList<JobInfo> expiredJobs=new ArrayList<JobInfo>();
  JobInfos jobInfos=getCompletedJobs();
  for (  JobInfo job : jobInfos.getJobInfoList()) {
    long executedTime=job.commandExecutionDate;
    long currentTime=System.currentTimeMillis();
    long jobsRetentionPeriod=86400000;
    managedJobConfig=domain.getExtensionByType(ManagedJobConfig.class);
    jobsRetentionPeriod=convert(managedJobConfig.getJobRetentionPeriod());
    if (currentTime - executedTime > jobsRetentionPeriod && job.exitCode.equals(AdminCommandState.State.COMPLETED.name())) {
      expiredJobs.add(job);
    }
  }
  return expiredJobs;
}

Fixed version (ground truth):
/** 
 * This will return a list of jobs which have crossed the JOBS_RETENTION_PERIOD and need to be purged
 * @return  list of jobs to be purged
 */
public synchronized ArrayList<JobInfo> getExpiredJobs(){
  ArrayList<JobInfo> expiredJobs=new ArrayList<JobInfo>();
  JobInfos jobInfos=getCompletedJobs();
  for (  JobInfo job : jobInfos.getJobInfoList()) {
    long executedTime=job.commandExecutionDate;
    long currentTime=System.currentTimeMillis();
    long jobsRetentionPeriod=86400000;
    managedJobConfig=domain.getExtensionByType(ManagedJobConfig.class);
    jobsRetentionPeriod=convert(managedJobConfig.getJobRetentionPeriod());
    if (currentTime - executedTime > jobsRetentionPeriod && job.state.equals(AdminCommandState.State.COMPLETED.name())) {
      expiredJobs.add(job);
    }
  }
  return expiredJobs;
}
Program: 28764
Project: 28764
Buggy source:
public StandardSessionFacade run(){
  return new StandardSessionFacade(fsession);
}

Fixed version (ground truth):
@Override public Void run(){
  Thread.currentThread().setContextClassLoader(cl);
  return null;
}
Program: 28766
Project: 28766
Buggy source:
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=Map.class,required=true),@HandlerInput(name="String_Node_Str",type=String.class,required=true)}) public static void saveLoggingAttributes(HandlerContext handlerCtx){
  Map<String,Object> attrs=(Map<String,Object>)handlerCtx.getInputValue("String_Node_Str");
  String config=(String)handlerCtx.getInputValue("String_Node_Str");
  Map<String,Object> props=new HashMap();
  try {
    for (    String key : attrs.keySet()) {
      if ((key.equals("String_Node_Str") || key.equals("String_Node_Str") || key.equals("String_Node_Str")|| key.equals("String_Node_Str")) && (attrs.get(key) == null)) {
        attrs.put(key,"String_Node_Str");
      }
      props.put("String_Node_Str",key + "String_Node_Str" + attrs.get(key)+ "String_Node_Str");
      props.put("String_Node_Str",config);
      RestUtil.restRequest((String)GuiUtil.getSessionValue("String_Node_Str") + "String_Node_Str",props,"String_Node_Str",null,false,true);
    }
  }
 catch (  Exception ex) {
    GuiUtil.handleException(handlerCtx,ex);
    if (GuiUtil.getLogger().isLoggable(Level.FINE)) {
      ex.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Handler(id="String_Node_Str",input={@HandlerInput(name="String_Node_Str",type=Map.class,required=true),@HandlerInput(name="String_Node_Str",type=String.class,required=true)}) public static void saveLoggingAttributes(HandlerContext handlerCtx){
  Map<String,Object> attrs=(Map<String,Object>)handlerCtx.getInputValue("String_Node_Str");
  String config=(String)handlerCtx.getInputValue("String_Node_Str");
  Map<String,Object> props=new HashMap();
  try {
    for (    Map.Entry<String,Object> e : attrs.entrySet()) {
      String key=e.getKey();
      if ((key.equals("String_Node_Str") || key.equals("String_Node_Str") || key.equals("String_Node_Str")|| key.equals("String_Node_Str")) && (e.getValue() == null)) {
        attrs.put(key,"String_Node_Str");
      }
      props.put("String_Node_Str",key + "String_Node_Str" + attrs.get(key)+ "String_Node_Str");
      props.put("String_Node_Str",config);
      RestUtil.restRequest((String)GuiUtil.getSessionValue("String_Node_Str") + "String_Node_Str",props,"String_Node_Str",null,false,true);
    }
  }
 catch (  Exception ex) {
    GuiUtil.handleException(handlerCtx,ex);
    if (GuiUtil.getLogger().isLoggable(Level.FINE)) {
      ex.printStackTrace();
    }
  }
}
Program: 28767
Project: 28767
Buggy source:
private boolean isDBEnabled(){
  Domain domain=Globals.get(Domain.class);
  ServerContext serverContext=Globals.get(ServerContext.class);
  Server server=domain.getServerNamed(serverContext.getInstanceName());
  AvailabilityService as=server.getConfig().getAvailabilityService();
  JmsService jmsService=server.getConfig().getExtensionByType(JmsService.class);
  if (as != null) {
    JmsAvailability jmsAvailability=as.getExtensionByType(JmsAvailability.class);
    if (jmsAvailability.getAvailabilityEnabled() != null && Boolean.parseBoolean(jmsAvailability.getAvailabilityEnabled())) {
      return true;
    }
 else     if (jmsAvailability.getConfigStoreType() != null && !"String_Node_Str".equalsIgnoreCase(jmsAvailability.getConfigStoreType()))     return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean isDBEnabled(){
  Domain domain=Globals.get(Domain.class);
  ServerContext serverContext=Globals.get(ServerContext.class);
  Server server=domain.getServerNamed(serverContext.getInstanceName());
  AvailabilityService as=server.getConfig().getAvailabilityService();
  if (as != null) {
    JmsAvailability jmsAvailability=as.getExtensionByType(JmsAvailability.class);
    if (jmsAvailability.getAvailabilityEnabled() != null && Boolean.parseBoolean(jmsAvailability.getAvailabilityEnabled())) {
      return true;
    }
 else     if (jmsAvailability.getConfigStoreType() != null && !"String_Node_Str".equalsIgnoreCase(jmsAvailability.getConfigStoreType()))     return true;
  }
  return false;
}
Program: 28768
Project: 28768
Buggy source:
@POST @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_FORM_URLENCODED}) public ActionReportResult hack(ParameterMap data){
  if (data.containsKey("String_Node_Str")) {
    List<String> l=data.get("String_Node_Str");
    if (l.contains("String_Node_Str")) {
      data.remove("String_Node_Str");
    }
  }
  return processDeleteLegacyFormat(data);
}

Fixed version (ground truth):
@POST @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.APPLICATION_FORM_URLENCODED}) public ActionReportResult hack(ParameterMap data){
  if (data != null && data.containsKey("String_Node_Str")) {
    List<String> l=data.get("String_Node_Str");
    if (l.contains("String_Node_Str")) {
      data.remove("String_Node_Str");
    }
  }
  return processDeleteLegacyFormat(data);
}
Program: 28769
Project: 28769
Buggy source:
private Properties prepareUndeployActionProperties(String archiveName,String target){
  DeploymentProperties dProps=new DeploymentProperties();
  String appName=archiveName;
  List<Application> applications=apps.getApplications();
  for (  Application app : applications) {
    if (app.getDeployProperties().getProperty(DeploymentProperties.DEFAULT_APP_NAME).equals(archiveName)) {
      appName=app.getName();
    }
  }
  dProps.setName(appName);
  return (Properties)dProps;
}

Fixed version (ground truth):
private Properties prepareUndeployActionProperties(String archiveName,String target){
  DeploymentProperties dProps=new DeploymentProperties();
  String appName=archiveName;
  List<Application> applications=apps.getApplications();
  for (  Application app : applications) {
    String defaultAppName=app.getDeployProperties().getProperty(DeploymentProperties.DEFAULT_APP_NAME);
    if (defaultAppName != null && defaultAppName.equals(archiveName)) {
      appName=app.getName();
    }
  }
  dProps.setName(appName);
  return (Properties)dProps;
}
Program: 28771
Project: 28771
Buggy source:
private long getLastSampleTime(HashMap clusterInfo,String lastSampleTimeKey,int numofInstances){
  long[] values=new long[numofInstances];
  int index=0;
  Iterator it=clusterInfo.keySet().iterator();
  while (it.hasNext()) {
    String s=(String)it.next();
    if (s.contains(lastSampleTimeKey)) {
      values[index++]=Long.parseLong((String)clusterInfo.get(s));
    }
  }
  Arrays.sort(values);
  return values[values.length - 1];
}

Fixed version (ground truth):
private long getLastSampleTime(HashMap<String,String> clusterInfo,String lastSampleTimeKey,int numofInstances){
  long[] values=new long[numofInstances];
  int index=0;
  for (  Map.Entry e : clusterInfo.entrySet()) {
    String key=(String)e.getKey();
    String value=(String)e.getValue();
    if (key.contains(lastSampleTimeKey)) {
      values[index++]=Long.parseLong(value);
    }
  }
  Arrays.sort(values);
  return values[values.length - 1];
}
Program: 28773
Project: 28773
Buggy source:
@Override public void addListener(AsyncListener listener,ServletRequest servletRequest,ServletResponse servletResponse){
  if (listener == null || servletRequest == null || servletResponse == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!isOkToConfigure.get()) {
    throw new IllegalStateException(STRING_MANAGER.getString("String_Node_Str"));
  }
synchronized (asyncListenerContexts) {
    asyncListenerContexts.add(new AsyncListenerContext(listener,servletRequest,servletResponse));
  }
}

Fixed version (ground truth):
@Override public void addListener(AsyncListener listener,ServletRequest servletRequest,ServletResponse servletResponse){
  if (listener == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (servletRequest == null || servletResponse == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!isOkToConfigure.get()) {
    throw new IllegalStateException(STRING_MANAGER.getString("String_Node_Str"));
  }
synchronized (asyncListenerContexts) {
    asyncListenerContexts.add(new AsyncListenerContext(listener,servletRequest,servletResponse));
  }
}
Program: 28775
Project: 28775
Buggy source:
private void init(OutputStream outStream,String dirName) throws ZipFileException {
  try {
    if (dirName == null)     throw new IllegalArgumentException("String_Node_Str");
    File f=new File(dirName);
    if (!f.exists())     throw new ZipFileException("String_Node_Str" + dirName + "String_Node_Str");
    if (!f.isDirectory())     throw new ZipFileException(dirName + "String_Node_Str");
    try {
      dirName=f.getCanonicalPath();
    }
 catch (    IOException e) {
      dirName=f.getAbsolutePath();
    }
    dirName=dirName.replace('\\','/');
    if (!dirName.endsWith("String_Node_Str"))     dirName+="String_Node_Str";
    this.dirName=dirName;
    zipStream=new ZipOutputStream(outStream);
  }
 catch (  ZipFileException zfe) {
    throw zfe;
  }
catch (  Throwable t) {
    throw new ZipFileException(t);
  }
}

Fixed version (ground truth):
private void init(OutputStream outStream,String dirName) throws ZipFileException {
  try {
    userStream=outStream;
    if (dirName == null)     throw new IllegalArgumentException("String_Node_Str");
    File f=new File(dirName);
    if (!f.exists())     throw new ZipFileException("String_Node_Str" + dirName + "String_Node_Str");
    if (!f.isDirectory())     throw new ZipFileException(dirName + "String_Node_Str");
    try {
      dirName=f.getCanonicalPath();
    }
 catch (    IOException e) {
      dirName=f.getAbsolutePath();
    }
    dirName=dirName.replace('\\','/');
    if (!dirName.endsWith("String_Node_Str"))     dirName+="String_Node_Str";
    this.dirName=dirName;
  }
 catch (  ZipFileException zfe) {
    throw zfe;
  }
catch (  Throwable t) {
    throw new ZipFileException(t);
  }
}
Program: 28776
Project: 28776
Buggy source:
/** 
 * Does not throw an exception when there is a duplicate zip entry.
 * @throws ZipFileException if an error while creating the archive
 */
public void safeWrite() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      try {
        addEntry(items[i]);
      }
 catch (      ZipException e) {
      }
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}

Fixed version (ground truth):
/** 
 * Does not throw an exception when there is a duplicate zip entry.
 * @throws ZipFileException if an error while creating the archive
 */
public void safeWrite() throws ZipFileException {
  try {
    setupZipStream();
    for (int i=0; i < items.length; i++) {
      try {
        addEntry(items[i]);
      }
 catch (      ZipException e) {
      }
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}
Program: 28777
Project: 28777
Buggy source:
public void write() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      addEntry(items[i]);
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}

Fixed version (ground truth):
public void write() throws ZipFileException {
  try {
    setupZipStream();
    for (int i=0; i < items.length; i++) {
      addEntry(items[i]);
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}
Program: 28778
Project: 28778
Buggy source:
/** 
 * Utility method to find the user names from a subject. The method assumes the user name is represented by   {@link org.glassfish.security.common.PrincipalImpl PrincipalImpl } inside the Subject's principal set.
 * @param subject the subject from which to find the user name
 * @return a list of strings representing the user name. The list may have more than one entry if the subject's principal setcontains more than one PrincipalImpl instances, or empty entry (i.e., anonymous user) if the subject's principal set contains no PrincipalImpl instances. 
 */
public static List<String> getUsernamesFromSubject(Subject subject){
  List<String> userList=new ArrayList<String>();
  Set<Principal> princSet=null;
  if (subject != null) {
    princSet=subject.getPrincipals();
    for (    Principal p : princSet) {
      if ((p != null) && (p.getClass().isAssignableFrom(PrincipalImpl.class) || "String_Node_Str".equals(p.getClass().getCanonicalName()))) {
        String uName=p.getName();
        userList.add(uName);
      }
    }
  }
  return userList;
}

Fixed version (ground truth):
/** 
 * Utility method to find the user names from a subject. The method assumes the user name is represented by   {@link org.glassfish.security.common.PrincipalImpl PrincipalImpl } inside the Subject's principal set.
 * @param subject the subject from which to find the user name
 * @return a list of strings representing the user name. The list may have more than one entry if the subject's principal setcontains more than one PrincipalImpl instances, or empty entry (i.e., anonymous user) if the subject's principal set contains no PrincipalImpl instances.
 */
public static List<String> getUsernamesFromSubject(Subject subject){
  List<String> userList=new ArrayList<String>();
  Set<Principal> princSet=null;
  if (subject != null) {
    princSet=subject.getPrincipals();
    for (    Principal p : princSet) {
      if ((p != null) && (p.getClass().isAssignableFrom(PrincipalImpl.class) || "String_Node_Str".equals(p.getClass().getCanonicalName()))) {
        String uName=p.getName();
        userList.add(uName);
      }
    }
  }
  return userList;
}
Program: 28779
Project: 28779
Buggy source:
/** 
 * Utility method to find the group names from a subject. The method assumes the group name is represented by   {@link org.glassfish.security.common.Group Group } inside the Subject's principal set.
 * @param subject the subject from which to find the username
 * @return a list of strings representing the group names. The list may have more than one entry if the subject's principal setcontains more than one Group instances, or empty entry if the subject's principal set contains no Group instances. 
 */
public static List<String> getGroupnamesFromSubject(Subject subject){
  List<String> groupList=new ArrayList<String>();
  Set<Group> princSet=null;
  if (subject != null) {
    princSet=subject.getPrincipals(Group.class);
    for (    Principal g : princSet) {
      String gName=g.getName();
      groupList.add(gName);
    }
  }
  return groupList;
}

Fixed version (ground truth):
/** 
 * Utility method to find the group names from a subject. The method assumes the group name is represented by   {@link org.glassfish.security.common.Group Group } inside the Subject's principal set.
 * @param subject the subject from which to find the username
 * @return a list of strings representing the group names. The list may have more than one entry if the subject's principal setcontains more than one Group instances, or empty entry if the subject's principal set contains no Group instances.
 */
public static List<String> getGroupnamesFromSubject(Subject subject){
  List<String> groupList=new ArrayList<String>();
  Set<Group> princSet=null;
  if (subject != null) {
    princSet=subject.getPrincipals(Group.class);
    for (    PrincipalImpl g : princSet) {
      String gName=g.getName();
      groupList.add(gName);
    }
  }
  return groupList;
}
Program: 28780
Project: 28780
Buggy source:
/** 
 * Does not throw an exception when there is a duplicate zip entry.
 * @throws ZipFileException if an error while creating the archive
 */
public void safeWrite() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      try {
        addEntry(items[i]);
      }
 catch (      ZipException e) {
      }
    }
    zipStream.close();
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
}

Fixed version (ground truth):
/** 
 * Does not throw an exception when there is a duplicate zip entry.
 * @throws ZipFileException if an error while creating the archive
 */
public void safeWrite() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      try {
        addEntry(items[i]);
      }
 catch (      ZipException e) {
      }
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}
Program: 28781
Project: 28781
Buggy source:
public void write() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      addEntry(items[i]);
    }
    zipStream.close();
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
}

Fixed version (ground truth):
public void write() throws ZipFileException {
  try {
    for (int i=0; i < items.length; i++) {
      addEntry(items[i]);
    }
  }
 catch (  ZipFileException z) {
    throw z;
  }
catch (  Exception e) {
    throw new ZipFileException(e);
  }
 finally {
    close();
  }
}
Program: 28783
Project: 28783
Buggy source:
WebXmlParser(ReadableArchive archive) throws XMLStreamException, IOException {
  if (archive.exists(getXmlFileName())) {
    init(archive.getEntry(getXmlFileName()));
  }
}

Fixed version (ground truth):
WebXmlParser(ReadableArchive archive) throws XMLStreamException, IOException {
  if (archive.exists(getXmlFileName())) {
    try (InputStream is=archive.getEntry(getXmlFileName())){
      init(is);
    }
   }
}
Program: 28784
Project: 28784
Buggy source:
protected void init(InputStream input) throws XMLStreamException {
  try {
    read(input);
  }
  finally {
    if (parser != null) {
      try {
        parser.close();
      }
 catch (      Exception ex) {
      }
    }
    if (input != null) {
      try {
        input.close();
      }
 catch (      Exception ex) {
      }
    }
  }
}

Fixed version (ground truth):
protected void init(InputStream input) throws XMLStreamException {
  try {
    read(input);
  }
  finally {
    if (parser != null) {
      try {
        parser.close();
      }
 catch (      Exception ex) {
      }
    }
  }
}
Program: 28785
Project: 28785
Buggy source:
ContextXmlParser(File contextXmlFile) throws XMLStreamException, FileNotFoundException {
  if (contextXmlFile.exists()) {
    init(new FileInputStream(contextXmlFile));
  }
}

Fixed version (ground truth):
ContextXmlParser(File contextXmlFile) throws XMLStreamException, IOException {
  if (contextXmlFile.exists()) {
    try (InputStream is=new FileInputStream(contextXmlFile)){
      init(is);
    }
   }
}
Program: 28786
Project: 28786
Buggy source:
@Override protected boolean removeEldestEntry(Map.Entry<T,T> eldest){
  if (size() > cacheSize) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean removeEldestEntry(Map.Entry<K,V> eldest){
  if (size() > cacheSize) {
    return true;
  }
  return false;
}
Program: 28787
Project: 28787
Buggy source:
public LruCache(final int cacheSize){
  cache=new LinkedHashMap<T,T>(){
    private static final long serialVersionUID=1L;
    @Override protected boolean removeEldestEntry(    Map.Entry<T,T> eldest){
      if (size() > cacheSize) {
        return true;
      }
      return false;
    }
  }
;
}

Fixed version (ground truth):
public LruCache(final int cacheSize){
  cache=new FixSizeLinkedHashMap<T,T>(cacheSize);
}
Program: 28789
Project: 28789
Buggy source:
/** 
 * Obtain servlet name from invocation. <P>In order to obtain the servlet name the following must be true: The ComponentInvocation contains a 'class' of type HttpServlet, which contains a valid ServletConfig object. This method returns the value returned by getServletName() on the ServletConfig. If the above is not met, null is returned.
 * @param inv The invocation object to process.
 * @return Servlet name or null.
 */
private String getServletName(ComponentInvocation inv){
  Object invInstance=inv.getInstance();
  if (invInstance instanceof HttpServlet) {
    HttpServlet thisServlet=(HttpServlet)invInstance;
    ServletConfig svc=thisServlet.getServletConfig();
    if (svc != null) {
      return thisServlet.getServletName();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Obtain servlet name from invocation. <P>In order to obtain the servlet name one of the following must be true: 1. The instanceName of the ComponentInvocation is not null 2. The ComponentInvocation contains a 'class' of type HttpServlet, which contains a valid ServletConfig object. This method returns the value returned  by getServletName() on the ServletConfig. <P>If the above is not met, null is returned.
 * @param inv The invocation object to process.
 * @return Servlet name or null.
 */
private String getServletName(ComponentInvocation inv){
  String servletName=inv.getInstanceName();
  if (servletName != null) {
    return servletName;
  }
  Object invInstance=inv.getInstance();
  if (invInstance instanceof HttpServlet) {
    HttpServlet thisServlet=(HttpServlet)invInstance;
    ServletConfig svc=thisServlet.getServletConfig();
    if (svc != null) {
      return thisServlet.getServletName();
    }
  }
  return null;
}
Program: 28790
Project: 28790
Buggy source:
public WebComponentInvocation(WebModule wm,Object instance){
  setComponentInvocationType(ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION);
  componentId=wm.getComponentId();
  jndiEnvironment=wm.getWebBundleDescriptor();
  container=wm;
  this.instance=instance;
  setResourceTableKey(_getResourceTableKey());
  moduleName=wm.getModuleName();
  appName=wm.getWebBundleDescriptor().getApplication().getAppName();
}

Fixed version (ground truth):
public WebComponentInvocation(WebModule wm,Object instance,String instanceName){
  this(wm,instance);
  this.instanceName=instanceName;
}
Program: 28792
Project: 28792
Buggy source:
@Override public synchronized void persist(Object obj){
  JobInfo jobInfo=(JobInfo)obj;
  File file=new File(serverEnvironment.getConfigDirPath(),JOBS_FILE);
  jobInfos=jobManager.getCompletedJobs();
  if (jobInfos == null)   jobInfos=new JobInfos();
  try {
    JAXBContext jaxbContext=JAXBContext.newInstance(JobInfos.class);
    jaxbMarshaller=jaxbContext.createMarshaller();
    jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
    jobInfos.getJobInfoList().add(jobInfo);
    jaxbMarshaller.marshal(jobInfos,file);
    jobManager.purgeJob(jobInfo.jobId);
  }
 catch (  JAXBException e) {
    throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobInfo.jobId,e.getLocalizedMessage()));
  }
}

Fixed version (ground truth):
@Override public void persist(Object obj){
  JobInfo jobInfo=(JobInfo)obj;
  File file=jobManager.getJobsFile();
synchronized (file) {
    jobInfos=jobManager.getCompletedJobs();
    if (jobInfos == null)     jobInfos=new JobInfos();
    try {
      JAXBContext jaxbContext=JAXBContext.newInstance(JobInfos.class);
      jaxbMarshaller=jaxbContext.createMarshaller();
      jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
      jobInfos.getJobInfoList().add(jobInfo);
      jaxbMarshaller.marshal(jobInfos,file);
      jobManager.purgeJob(jobInfo.jobId);
    }
 catch (    JAXBException e) {
      throw new RuntimeException(adminStrings.getLocalString("String_Node_Str","String_Node_Str",jobInfo.jobId,e.getLocalizedMessage()));
    }
  }
}