Program: 119592
Project: 119592
Buggy source:
@Override protected void doSyncRoutine(RoutineItem routineItem,boolean copyToTemp) throws SystemException {
  FileOutputStream fos=null;
  try {
    IFile file=getRoutineFile(routineItem);
    if (routineItem.getProperty().getModificationDate() != null) {
      long modificationItemDate=routineItem.getProperty().getModificationDate().getTime();
      long modificationFileDate=file.getModificationStamp();
      if (modificationItemDate <= modificationFileDate) {
        return;
      }
    }
 else {
      routineItem.getProperty().setModificationDate(new Date());
    }
    if (copyToTemp) {
      String routineContent=new String(routineItem.getContent().getInnerContent());
      String version=VersionUtils.getVersion();
      if (routineContent.contains("String_Node_Str")) {
        IService service=GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        if (service instanceof AbstractBrandingService) {
          String routineHeader=((AbstractBrandingService)service).getRoutineLicenseHeader(version);
          routineContent=routineContent.replace("String_Node_Str",routineHeader);
        }
      }
      String label=routineItem.getProperty().getLabel();
      if (!label.equals(ITalendSynchronizer.TEMPLATE) && routineContent != null) {
        routineContent=routineContent.replaceAll(ITalendSynchronizer.TEMPLATE,label);
        File f=file.getLocation().toFile();
        fos=new FileOutputStream(f);
        fos.write(routineContent.getBytes());
        fos.close();
      }
    }
    file.refreshLocal(1,null);
  }
 catch (  CoreException e) {
    throw new SystemException(e);
  }
catch (  IOException e) {
    throw new SystemException(e);
  }
 finally {
    try {
      fos.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
@Override protected void doSyncRoutine(RoutineItem routineItem,boolean copyToTemp) throws SystemException {
  FileOutputStream fos=null;
  try {
    IFile file=getRoutineFile(routineItem);
    if (routineItem.getProperty().getModificationDate() != null) {
      long modificationItemDate=routineItem.getProperty().getModificationDate().getTime();
      long modificationFileDate=file.getModificationStamp();
      if (modificationItemDate <= modificationFileDate) {
        return;
      }
    }
 else {
      routineItem.getProperty().setModificationDate(new Date());
    }
    if (copyToTemp) {
      String routineContent=new String(routineItem.getContent().getInnerContent());
      String version=VersionUtils.getVersion();
      if (routineContent.contains("String_Node_Str")) {
        IService service=GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        String routineHeader=((IBrandingService)service).getRoutineLicenseHeader(version);
        routineContent=routineContent.replace("String_Node_Str",routineHeader);
      }
      String label=routineItem.getProperty().getLabel();
      if (!label.equals(ITalendSynchronizer.TEMPLATE) && routineContent != null) {
        routineContent=routineContent.replaceAll(ITalendSynchronizer.TEMPLATE,label);
        File f=file.getLocation().toFile();
        fos=new FileOutputStream(f);
        fos.write(routineContent.getBytes());
        fos.close();
      }
    }
    file.refreshLocal(1,null);
  }
 catch (  CoreException e) {
    throw new SystemException(e);
  }
catch (  IOException e) {
    throw new SystemException(e);
  }
 finally {
    try {
      fos.close();
    }
 catch (    Exception e) {
    }
  }
}