nus-yam/ex-repair huggingface dataset:
Program: 170372
Project: 170372
Buggy source:
/** 
 * Get the tile layout with opj_dump
 * @param opjdumpPath path to opj_dump
 * @param jp2FilePath the path to the jpeg file
 * @return the tile layout for the openjpeg file
 * @throws IOException
 * @throws InterruptedException
 */
public static TileLayout getTileLayoutWithOpenJPEG(String opjdumpPath,Path jp2FilePath) throws IOException, InterruptedException {
  if (opjdumpPath == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  TileLayout tileLayout;
  String pathToImageFile=jp2FilePath.toAbsolutePath().toString();
  if (SystemUtils.IS_OS_WINDOWS) {
    pathToImageFile=Utils.GetIterativeShortPathNameW(pathToImageFile);
  }
  ProcessBuilder builder=new ProcessBuilder(opjdumpPath,"String_Node_Str",pathToImageFile);
  builder.redirectErrorStream(true);
  CommandOutput exit=OpenJpegUtils.runProcess(builder);
  if (exit.getErrorCode() != 0) {
    StringBuilder sbu=new StringBuilder();
    for (    String fragment : builder.command()) {
      sbu.append(fragment);
      sbu.append(' ');
    }
    throw new IOException(String.format("String_Node_Str",sbu.toString(),exit.getErrorCode(),exit.getTextOutput(),exit.getErrorOutput()));
  }
  tileLayout=OpenJpegUtils.parseOpjDump(exit.getTextOutput());
  return tileLayout;
}

Fixed version (ground truth):
/** 
 * Get the tile layout with opj_dump
 * @param opjdumpPath path to opj_dump
 * @param jp2FilePath the path to the jpeg file
 * @return the tile layout for the openjpeg file
 * @throws IOException
 * @throws InterruptedException
 */
public static TileLayout getTileLayoutWithOpenJPEG(String opjdumpPath,Path jp2FilePath) throws IOException, InterruptedException {
  if (opjdumpPath == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  TileLayout tileLayout;
  String pathToImageFile=jp2FilePath.toAbsolutePath().toString();
  if (SystemUtils.IS_OS_WINDOWS) {
    pathToImageFile=Utils.GetIterativeShortPathNameW(pathToImageFile);
  }
  ProcessBuilder builder=new ProcessBuilder(opjdumpPath,"String_Node_Str",pathToImageFile);
  builder.redirectErrorStream(true);
  CommandOutput exit=OpenJpegUtils.runProcess(builder);
  if (exit.getErrorCode() != 0) {
    StringBuilder sbu=new StringBuilder();
    for (    String fragment : builder.command()) {
      sbu.append(fragment);
      sbu.append(' ');
    }
    throw new IOException(String.format("String_Node_Str",sbu.toString(),exit.getErrorCode(),exit.getTextOutput(),exit.getErrorOutput()));
  }
  tileLayout=OpenJpegUtils.parseOpjDump(exit.getTextOutput());
  if (tileLayout.numResolutions == 0) {
    return null;
  }
  return tileLayout;
}
Program: 170373
Project: 170373
Buggy source:
public static CommandOutput runProcess(ProcessBuilder builder) throws InterruptedException, IOException {
  builder.environment().putAll(System.getenv());
  StringBuilder output=new StringBuilder();
  boolean isStopped=false;
  final Process process=builder.start();
  try (BufferedReader outReader=new BufferedReader(new InputStreamReader(process.getInputStream()))){
    while (!isStopped) {
      while (outReader.ready()) {
        String line=outReader.readLine();
        if (line != null && !line.isEmpty()) {
          output.append(line);
        }
      }
      if (!process.isAlive()) {
        isStopped=true;
      }
 else {
        Thread.yield();
      }
    }
    outReader.close();
  }
   int exitCode=process.exitValue();
  String errorOutput=convertStreamToString(process.getErrorStream());
  return new CommandOutput(exitCode,output.toString(),errorOutput);
}

Fixed version (ground truth):
public static CommandOutput runProcess(ProcessBuilder builder) throws InterruptedException, IOException {
  builder.environment().putAll(System.getenv());
  StringBuilder output=new StringBuilder();
  boolean isStopped=false;
  final Process process=builder.start();
  try (BufferedReader outReader=new BufferedReader(new InputStreamReader(process.getInputStream()))){
    while (!isStopped) {
      if (!process.isAlive()) {
        isStopped=true;
      }
 else {
        Thread.yield();
      }
      while (outReader.ready()) {
        String line=outReader.readLine();
        if (line != null && !line.isEmpty()) {
          output.append(line);
        }
      }
    }
    outReader.close();
  }
   int exitCode=process.exitValue();
  String errorOutput=convertStreamToString(process.getErrorStream());
  return new CommandOutput(exitCode,output.toString(),errorOutput);
}
Program: 170374
Project: 170374
Buggy source:
private void addIndexMasks(Product product,List<BandInfo> bandInfoList) throws IOException {
  for (  BandInfo bandInfo : bandInfoList) {
    if (bandInfo.getBandInformation() instanceof S2IndexBandInformation) {
      S2IndexBandInformation indexBandInformation=(S2IndexBandInformation)bandInfo.getBandInformation();
      IndexCoding indexCoding=indexBandInformation.getIndexCoding();
      product.getIndexCodingGroup().add(indexCoding);
      List<Color> colors=indexBandInformation.getColors();
      Iterator<Color> colorIterator=colors.iterator();
      for (      String indexName : indexCoding.getIndexNames()) {
        int indexValue=indexCoding.getIndexValue(indexName);
        String description=indexCoding.getIndex(indexName).getDescription();
        if (!colorIterator.hasNext()) {
          throw new IOException(String.format("String_Node_Str"));
        }
        Color color=colorIterator.next();
        Mask mask=Mask.BandMathsType.create("String_Node_Str" + indexName.toLowerCase(),description,product.getSceneRasterWidth(),product.getSceneRasterHeight(),String.format("String_Node_Str",indexBandInformation.getPhysicalBand(),indexValue),color,0.5);
        product.addMask(mask);
      }
    }
  }
}

Fixed version (ground truth):
private void addIndexMasks(Product product,List<BandInfo> bandInfoList,S2OrthoSceneLayout sceneDescription) throws IOException {
  for (  BandInfo bandInfo : bandInfoList) {
    if (bandInfo.getBandInformation() instanceof S2IndexBandInformation) {
      S2IndexBandInformation indexBandInformation=(S2IndexBandInformation)bandInfo.getBandInformation();
      IndexCoding indexCoding=indexBandInformation.getIndexCoding();
      product.getIndexCodingGroup().add(indexCoding);
      Dimension dimension=sceneDescription.getSceneDimension(bandInfo.getBandInformation().getResolution());
      List<Color> colors=indexBandInformation.getColors();
      Iterator<Color> colorIterator=colors.iterator();
      for (      String indexName : indexCoding.getIndexNames()) {
        int indexValue=indexCoding.getIndexValue(indexName);
        String description=indexCoding.getIndex(indexName).getDescription();
        if (!colorIterator.hasNext()) {
          throw new IOException(String.format("String_Node_Str"));
        }
        Color color=colorIterator.next();
        Mask mask=Mask.BandMathsType.create("String_Node_Str" + indexName.toLowerCase(),description,dimension.width,dimension.height,String.format("String_Node_Str",indexBandInformation.getPhysicalBand(),indexValue),color,0.5);
        product.addMask(mask);
      }
    }
  }
}
Program: 170376
Project: 170376
Buggy source:
protected Path decompressTile(int tileIndex,int level) throws IOException {
  Path tileFile=PathUtils.get(cacheDir,PathUtils.getFileNameWithoutExtension(imageFile).toLowerCase() + "String_Node_Str" + String.valueOf(tileIndex)+ "String_Node_Str"+ String.valueOf(level)+ "String_Node_Str");
  if ((!Files.exists(tileFile)) || (diffLastModifiedTimes(tileFile.toFile(),imageFile.toFile()) < 0L)) {
    final OpjExecutor decompress=new OpjExecutor(OpenJpegExecRetriever.getOpjDecompress());
    final Map<String,String> params=new HashMap<String,String>(){
{
        put("String_Node_Str",GetIterativeShortPathNameW(imageFile.toString()));
        put("String_Node_Str",String.valueOf(level));
        put("String_Node_Str","String_Node_Str");
      }
    }
;
    params.put("String_Node_Str",tileFile.toString());
    params.put("String_Node_Str",String.valueOf(tileIndex));
    params.put("String_Node_Str",String.valueOf(DataBuffer.getDataTypeSize(this.getSampleModel().getDataType())));
    params.put("String_Node_Str","String_Node_Str");
    if (decompress.execute(params) != 0) {
      logger.severe(decompress.getLastError());
      tileFile=null;
    }
 else {
      logger.fine("String_Node_Str" + String.valueOf(tileIndex) + "String_Node_Str"+ String.valueOf(level));
    }
  }
  return tileFile;
}

Fixed version (ground truth):
protected Path decompressTile(int tileIndex,int level) throws IOException {
  Path tileFile=PathUtils.get(cacheDir,PathUtils.getFileNameWithoutExtension(imageFile).toLowerCase() + "String_Node_Str" + String.valueOf(tileIndex)+ "String_Node_Str"+ String.valueOf(level)+ "String_Node_Str");
  if ((!Files.exists(tileFile)) || (diffLastModifiedTimes(tileFile.toFile(),imageFile.toFile()) < 0L)) {
    final OpjExecutor decompress=new OpjExecutor(OpenJpegExecRetriever.getOpjDecompress());
    final Map<String,String> params=new HashMap<String,String>(){
{
        put("String_Node_Str",GetIterativeShortPathNameW(imageFile.toString()));
        put("String_Node_Str",String.valueOf(level));
        put("String_Node_Str","String_Node_Str");
      }
    }
;
    String tileFileName;
    if (org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS && (tileFile.getParent() != null)) {
      tileFileName=Utils.GetIterativeShortPathNameW(tileFile.getParent().toString()) + File.separator + tileFile.getName(tileFile.getNameCount() - 1);
    }
 else {
      tileFileName=tileFile.toString();
    }
    params.put("String_Node_Str",tileFileName);
    params.put("String_Node_Str",String.valueOf(tileIndex));
    params.put("String_Node_Str",String.valueOf(DataBuffer.getDataTypeSize(this.getSampleModel().getDataType())));
    params.put("String_Node_Str","String_Node_Str");
    if (decompress.execute(params) != 0) {
      logger.severe(decompress.getLastError());
      tileFile=null;
    }
 else {
      logger.fine("String_Node_Str" + String.valueOf(tileIndex) + "String_Node_Str"+ String.valueOf(level));
    }
  }
  return tileFile;
}
Program: 170378
Project: 170378
Buggy source:
@Override protected Product readProductNodesImpl() throws IOException {
  SystemUtils.LOG.fine("String_Node_Str" + getInput().toString());
  Product p;
  final File inputFile=new File(getInput().toString());
  if (!inputFile.exists()) {
    throw new FileNotFoundException(inputFile.getPath());
  }
  if (S2ProductFilename.isMetadataFilename(inputFile.getName())) {
    p=getMosaicProduct(inputFile);
    addQuicklook(p,getQuicklookFile(inputFile));
    if (p != null) {
      p.setModified(false);
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  return p;
}

Fixed version (ground truth):
@Override protected Product readProductNodesImpl() throws IOException {
  SystemUtils.LOG.fine("String_Node_Str" + getInput().toString());
  Product p;
  final File inputFile;
  String longInput=GetLongPathNameW(getInput().toString());
  if (longInput.length() != 0) {
    inputFile=new File(longInput);
  }
 else {
    inputFile=new File(getInput().toString());
  }
  if (!inputFile.exists()) {
    throw new FileNotFoundException(inputFile.getPath());
  }
  if (S2ProductFilename.isMetadataFilename(inputFile.getName())) {
    p=getMosaicProduct(inputFile);
    addQuicklook(p,getQuicklookFile(inputFile));
    if (p != null) {
      p.setModified(false);
    }
  }
 else {
    throw new IOException("String_Node_Str");
  }
  return p;
}
Program: 170382
Project: 170382
Buggy source:
public static String getSafeInfoExtractor(){
  try {
    File candidateByAPI=InstalledFileLocator.getDefault().locate(getInfoExtractor(),null,false);
    return candidateByAPI.getAbsolutePath();
  }
 catch (  IOException e) {
    return null;
  }
catch (  InterruptedException e) {
    return null;
  }
}

Fixed version (ground truth):
public static String getSafeInfoExtractor(){
  try {
    String nbDirs=System.getProperty("String_Node_Str");
    String[] dirModuleCandidates=nbDirs.split(SystemUtils.PATH_SEPARATOR);
    File candidateByIteration=null;
    for (    String aModuleCandidate : dirModuleCandidates) {
      candidateByIteration=new File(aModuleCandidate,getInfoExtractor());
      if (candidateByIteration.exists()) {
        break;
      }
    }
    if (candidateByIteration != null) {
      return candidateByIteration.getAbsolutePath();
    }
    File candidateByAPI=InstalledFileLocator.getDefault().locate(getInfoExtractor(),null,false);
    if (candidateByAPI != null) {
      return candidateByAPI.getAbsolutePath();
    }
 else {
      return "String_Node_Str";
    }
  }
 catch (  IOException e) {
    return null;
  }
catch (  InterruptedException e) {
    return null;
  }
}
Program: 170383
Project: 170383
Buggy source:
public static String getSafeDecompressor(){
  try {
    File candidateByAPI=InstalledFileLocator.getDefault().locate(getDecompressor(),null,false);
    return candidateByAPI.getAbsolutePath();
  }
 catch (  InterruptedException e) {
    return null;
  }
catch (  IOException e) {
    return null;
  }
}

Fixed version (ground truth):
public static String getSafeDecompressor(){
  try {
    String nbDirs=System.getProperty("String_Node_Str");
    String[] dirModuleCandidates=nbDirs.split(SystemUtils.PATH_SEPARATOR);
    File candidateByIteration=null;
    for (    String aModuleCandidate : dirModuleCandidates) {
      candidateByIteration=new File(aModuleCandidate,getDecompressor());
      if (candidateByIteration.exists()) {
        break;
      }
    }
    if (candidateByIteration != null) {
      return candidateByIteration.getAbsolutePath();
    }
    File candidateByAPI=InstalledFileLocator.getDefault().locate(getDecompressor(),null,false);
    if (candidateByAPI != null) {
      return candidateByAPI.getAbsolutePath();
    }
 else {
      return "String_Node_Str";
    }
  }
 catch (  InterruptedException e) {
    return null;
  }
catch (  IOException e) {
    return null;
  }
}
Program: 170384
Project: 170384
Buggy source:
@Override public void run(){
  String usedPath=null;
  String winPath="String_Node_Str";
  String linuxPath="String_Node_Str";
  String linux64Path="String_Node_Str";
  String macPath="String_Node_Str";
  try {
    if (SystemUtils.IS_OS_LINUX) {
      Process p=Runtime.getRuntime().exec("String_Node_Str");
      p.waitFor();
      String output=convertStreamToString(p.getInputStream());
      String errorOutput=convertStreamToString(p.getErrorStream());
      if (output.startsWith("String_Node_Str")) {
        usedPath=linuxPath;
      }
 else {
        usedPath=linux64Path;
      }
    }
 else     if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
      usedPath=macPath;
    }
 else {
      usedPath=winPath;
    }
    String testExtension="String_Node_Str" + usedPath;
    FileObject fo=FileUtil.getConfigRoot();
    File theFileCandidate=FileUtil.toFile(fo);
    File relativeToFileCandidate=new File(theFileCandidate,testExtension);
    relativeToFileCandidate=relativeToFileCandidate.getCanonicalFile();
    if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
      setExecutable(relativeToFileCandidate,true);
    }
  }
 catch (  IOException e) {
    ErrorManager.getDefault().notify(e);
  }
catch (  InterruptedException e) {
    ErrorManager.getDefault().notify(e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  String infoExtractor=getSafeInfoExtractor();
  String decompressor=getSafeDecompressor();
  if (!infoExtractor.isEmpty()) {
    File infoExtractorFile=new File(infoExtractor);
    if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
      setExecutable(infoExtractorFile,true);
    }
  }
  if (!decompressor.isEmpty()) {
    File decompressorFile=new File(decompressor);
    if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
      setExecutable(decompressorFile,true);
    }
  }
}
Program: 170387
Project: 170387
Buggy source:
public static Object readJaxbFromFilename(InputStream stream) throws JAXBException, FileNotFoundException {
  ClassLoader s2c=Sentinel2L1BProductReader.class.getClassLoader();
  JAXBContext jaxbContext=JAXBContext.newInstance(MetadataType.L1B,s2c);
  Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
  Marshaller marshaller=jaxbContext.createMarshaller();
  Object ob=unmarshaller.unmarshal(stream);
  Object casted=((JAXBElement)ob).getValue();
  return casted;
}

Fixed version (ground truth):
public static Object readJaxbFromFilename(InputStream stream) throws JAXBException, FileNotFoundException {
  ClassLoader s2c=Sentinel2L1BProductReader.class.getClassLoader();
  JAXBContext jaxbContext=JAXBContext.newInstance(MetadataType.L1B,s2c);
  Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
  Object ob=unmarshaller.unmarshal(stream);
  Object casted=((JAXBElement)ob).getValue();
  return casted;
}
Program: 170388
Project: 170388
Buggy source:
public static Map<Integer,L1bMetadata.TileGeometry> getGranuleGeometries(Level1B_Granule product){
  String id=product.getGeneral_Info().getGRANULE_ID().getValue();
  List<Double> polygon=product.getGeometric_Info().getGranule_Footprint().getGranule_Footprint().getFootprint().getEXT_POS_LIST();
  List<Coordinate> thePoints=as3DCoordinates(polygon);
  Coordinate[] arr=thePoints.toArray(new Coordinate[thePoints.size()]);
  ReferencedEnvelope re=new ReferencedEnvelope(arr[0].x,arr[2].x,arr[0].y,arr[2].y,DefaultGeographicCRS.WGS84);
  Map<Integer,L1bMetadata.TileGeometry> resolutions=new HashMap<Integer,L1bMetadata.TileGeometry>();
  List<A_GRANULE_DIMENSIONS.Size> sizes=product.getGeometric_Info().getGranule_Dimensions().getSize();
  int pos=product.getGeometric_Info().getGranule_Position().getPOSITION();
  for (  A_GRANULE_DIMENSIONS.Size gpos : sizes) {
    int index=gpos.getResolution();
    L1bMetadata.TileGeometry tgeox=new L1bMetadata.TileGeometry();
    tgeox.numCols=gpos.getNCOLS();
    tgeox.numRows=gpos.getNROWS();
    tgeox.envelope=re;
    tgeox.position=pos;
    tgeox.xDim=index;
    tgeox.yDim=-index;
    resolutions.put(index,tgeox);
  }
  return resolutions;
}

Fixed version (ground truth):
public static Map<Integer,L1bMetadata.TileGeometry> getGranuleGeometries(Level1B_Granule product){
  List<Double> polygon=product.getGeometric_Info().getGranule_Footprint().getGranule_Footprint().getFootprint().getEXT_POS_LIST();
  List<Coordinate> thePoints=as3DCoordinates(polygon);
  Coordinate[] arr=thePoints.toArray(new Coordinate[thePoints.size()]);
  ReferencedEnvelope re=new ReferencedEnvelope(arr[0].x,arr[2].x,arr[0].y,arr[2].y,DefaultGeographicCRS.WGS84);
  Map<Integer,L1bMetadata.TileGeometry> resolutions=new HashMap<Integer,L1bMetadata.TileGeometry>();
  List<A_GRANULE_DIMENSIONS.Size> sizes=product.getGeometric_Info().getGranule_Dimensions().getSize();
  int pos=product.getGeometric_Info().getGranule_Position().getPOSITION();
  for (  A_GRANULE_DIMENSIONS.Size gpos : sizes) {
    int index=gpos.getResolution();
    L1bMetadata.TileGeometry tgeox=new L1bMetadata.TileGeometry();
    tgeox.numCols=gpos.getNCOLS();
    tgeox.numRows=gpos.getNROWS();
    tgeox.envelope=re;
    tgeox.position=pos;
    tgeox.xDim=index;
    tgeox.yDim=-index;
    BeamLogManager.getSystemLogger().warning("String_Node_Str" + tgeox.toString());
    resolutions.put(index,tgeox);
  }
  return resolutions;
}
Program: 170391
Project: 170391
Buggy source:
@Override public DecodeQualification getDecodeQualification(Object input){
  DecodeQualification qualification=DecodeQualification.UNABLE;
  File file=new File(input.toString());
  String fileName=file.getName().toLowerCase();
  if (fileName.endsWith("String_Node_Str")) {
    qualification=DecodeQualification.SUITABLE;
  }
 else   if (fileName.endsWith(RapidEyeConstants.METADATA_FILE_SUFFIX)) {
    File folder=file.getParentFile();
    File[] files=folder.listFiles();
    if (files != null) {
      boolean consistentProduct=true;
      for (      String namePattern : RapidEyeConstants.L1_FILENAME_PATTERNS) {
        if (!namePattern.endsWith("String_Node_Str")) {
          boolean patternMatched=false;
          for (          File f : files) {
            patternMatched|=f.getName().matches(namePattern);
          }
          consistentProduct&=patternMatched;
        }
      }
      if (consistentProduct)       qualification=DecodeQualification.INTENDED;
    }
  }
  return qualification;
}

Fixed version (ground truth):
@Override public DecodeQualification getDecodeQualification(Object input){
  DecodeQualification qualification=DecodeQualification.UNABLE;
  File file=new File(input.toString());
  String fileName=file.getName().toLowerCase();
  String[] files=null;
  if (fileName.endsWith("String_Node_Str")) {
    try {
      files=RapidEyeReader.getInput(input).list("String_Node_Str");
    }
 catch (    IOException e) {
    }
  }
 else   if (fileName.endsWith(RapidEyeConstants.METADATA_FILE_SUFFIX)) {
    File folder=file.getParentFile();
    files=folder.list();
  }
  if (files != null) {
    boolean consistentProduct=true;
    for (    String namePattern : RapidEyeConstants.L1_FILENAME_PATTERNS) {
      if (!namePattern.endsWith("String_Node_Str")) {
        boolean patternMatched=false;
        for (        String f : files) {
          patternMatched|=f.matches(namePattern);
        }
        consistentProduct&=patternMatched;
      }
    }
    if (consistentProduct)     qualification=DecodeQualification.INTENDED;
  }
  return qualification;
}
Program: 170393
Project: 170393
Buggy source:
@Override public DecodeQualification getDecodeQualification(Object input){
  DecodeQualification qualification=DecodeQualification.UNABLE;
  File file=new File(input.toString());
  String fileName=file.getName().toLowerCase();
  if (fileName.endsWith("String_Node_Str")) {
    qualification=DecodeQualification.SUITABLE;
  }
 else   if (fileName.endsWith(RapidEyeConstants.METADATA_FILE_SUFFIX)) {
    File folder=file.getParentFile();
    File[] files=folder.listFiles();
    if (files != null) {
      boolean consistentProduct=true;
      for (      String namePattern : RapidEyeConstants.L3_FILENAME_PATTERNS) {
        if (!namePattern.endsWith("String_Node_Str")) {
          boolean patternMatched=false;
          for (          File f : files) {
            patternMatched|=f.getName().matches(namePattern);
          }
          consistentProduct&=patternMatched;
        }
      }
      if (consistentProduct)       qualification=DecodeQualification.INTENDED;
    }
  }
  return qualification;
}

Fixed version (ground truth):
@Override public DecodeQualification getDecodeQualification(Object input){
  DecodeQualification qualification=DecodeQualification.UNABLE;
  File file=new File(input.toString());
  String fileName=file.getName().toLowerCase();
  String[] files=null;
  if (fileName.endsWith("String_Node_Str")) {
    try {
      files=RapidEyeReader.getInput(input).list("String_Node_Str");
    }
 catch (    IOException e) {
    }
  }
 else   if (fileName.endsWith(RapidEyeConstants.METADATA_FILE_SUFFIX)) {
    File folder=file.getParentFile();
    files=folder.list();
  }
  if (files != null) {
    boolean consistentProduct=true;
    for (    String namePattern : RapidEyeConstants.L3_FILENAME_PATTERNS) {
      if (!namePattern.endsWith("String_Node_Str")) {
        boolean patternMatched=false;
        for (        String f : files) {
          if (f.matches(RapidEyeConstants.NOT_L3_FILENAME_PATTERN)) {
            consistentProduct=false;
          }
 else {
            patternMatched|=f.matches(namePattern);
          }
        }
        consistentProduct&=patternMatched;
      }
    }
    if (consistentProduct)     qualification=DecodeQualification.INTENDED;
  }
  return qualification;
}
Program: 170394
Project: 170394
Buggy source:
public ProductData.UTC getCenterTime(){
  ProductData.UTC centerTime=null;
  MetadataElement currentElement;
  if (((currentElement=rootElement.getElement(SpotConstants.TAG_DATA_STRIP)) != null) && ((currentElement=currentElement.getElement(SpotConstants.TAG_SENSOR_CONFIGURATION)) != null) && ((currentElement=currentElement.getElement(SpotConstants.TAG_TIME_STAMP)) != null)) {
    String stringData=currentElement.getAttributeString(SpotConstants.TAG_SCENE_CENTER_TIME);
    if (stringData != null) {
      String milliseconds=stringData.substring(stringData.indexOf("String_Node_Str") + 1);
      try {
        Date date=new SimpleDateFormat(SpotConstants.UTC_DATE_FORMAT).parse(stringData);
        centerTime=ProductData.UTC.create(date,Long.parseLong(milliseconds));
      }
 catch (      ParseException pEx) {
        logger.warning(String.format(MISSING_ELEMENT_WARNING,SpotConstants.TAG_SCENE_CENTER_TIME));
      }
    }
  }
 else {
    logger.warning(String.format(MISSING_ELEMENT_WARNING,SpotConstants.TAG_SCENE_CENTER_TIME));
  }
  return centerTime;
}

Fixed version (ground truth):
public ProductData.UTC getCenterTime(){
  ProductData.UTC centerTime=null;
  MetadataElement currentElement;
  if (((currentElement=rootElement.getElement(SpotConstants.TAG_DATA_STRIP)) != null) && ((currentElement=currentElement.getElement(SpotConstants.TAG_SENSOR_CONFIGURATION)) != null) && ((currentElement=currentElement.getElement(SpotConstants.TAG_TIME_STAMP)) != null)) {
    String stringData=currentElement.getAttributeString(SpotConstants.TAG_SCENE_CENTER_TIME);
    if (stringData != null) {
      String milliseconds=stringData.substring(stringData.indexOf("String_Node_Str") + 1);
      stringData=stringData.substring(0,stringData.indexOf("String_Node_Str")) + "String_Node_Str";
      try {
        Date date=new SimpleDateFormat(SpotConstants.UTC_DATE_FORMAT).parse(stringData);
        centerTime=ProductData.UTC.create(date,Long.parseLong(milliseconds));
      }
 catch (      ParseException pEx) {
        logger.warning(String.format(MISSING_ELEMENT_WARNING,SpotConstants.TAG_SCENE_CENTER_TIME));
      }
    }
  }
 else {
    logger.warning(String.format(MISSING_ELEMENT_WARNING,SpotConstants.TAG_SCENE_CENTER_TIME));
  }
  return centerTime;
}
Program: 170395
Project: 170395
Buggy source:
public static String getModulesDir() throws URISyntaxException, FileNotFoundException {
  String subStr="String_Node_Str";
  ClassLoader s2c=Sentinel2ProductReader.class.getClassLoader();
  URLClassLoader s2ClassLoader=(URLClassLoader)s2c;
  URL[] theURLs=s2ClassLoader.getURLs();
  for (  URL url : theURLs) {
    if (url.getPath().contains(subStr) && url.getPath().contains("String_Node_Str")) {
      URI uri=url.toURI();
      URI parent=uri.getPath().endsWith("String_Node_Str") ? uri.resolve("String_Node_Str") : uri.resolve("String_Node_Str");
      return parent.getPath();
    }
  }
  throw new FileNotFoundException("String_Node_Str" + subStr + "String_Node_Str");
}

Fixed version (ground truth):
public static String getModulesDir() throws URISyntaxException, FileNotFoundException {
  String subStr="String_Node_Str";
  ClassLoader s2c=Sentinel2ProductReader.class.getClassLoader();
  URLClassLoader s2ClassLoader=(URLClassLoader)s2c;
  URL[] theURLs=s2ClassLoader.getURLs();
  for (  URL url : theURLs) {
    if (url.getPath().contains(subStr) && url.getPath().contains("String_Node_Str")) {
      URI uri=url.toURI();
      URI parent=uri.getPath().endsWith("String_Node_Str") ? uri.resolve("String_Node_Str") : uri.resolve("String_Node_Str");
      return parent.getPath();
    }
 else {
      if (url.getPath().contains(subStr)) {
        URI uri=url.toURI();
        URI parent=uri.getPath().endsWith("String_Node_Str") ? uri.resolve("String_Node_Str") : uri.resolve("String_Node_Str");
        return parent.getPath();
      }
    }
  }
  throw new FileNotFoundException("String_Node_Str" + subStr + "String_Node_Str");
}
Program: 170396
Project: 170396
Buggy source:
public static Object readJaxbFromFilename(InputStream stream) throws JAXBException, FileNotFoundException {
  JAXBContext jaxbContext=JAXBContext.newInstance("String_Node_Str");
  Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
  Marshaller marshaller=jaxbContext.createMarshaller();
  Object ob=unmarshaller.unmarshal(stream);
  Object casted=((JAXBElement)ob).getValue();
  return casted;
}

Fixed version (ground truth):
public static Object readJaxbFromFilename(InputStream stream) throws JAXBException, FileNotFoundException {
  ClassLoader s2c=Sentinel2ProductReader.class.getClassLoader();
  JAXBContext jaxbContext=JAXBContext.newInstance("String_Node_Str",s2c);
  Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
  Marshaller marshaller=jaxbContext.createMarshaller();
  Object ob=unmarshaller.unmarshal(stream);
  Object casted=((JAXBElement)ob).getValue();
  return casted;
}
Program: 170397
Project: 170397
Buggy source:
static PlanarImage create(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,S2SpatialResolution spatialResolution,int level){
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  Assert.notNull(spatialResolution,"String_Node_Str");
  if (imageFile != null) {
    PlanarImage opImage=new L1cTileOpImage(imageFile,cacheDir,imagePos,l1cTileLayout,imageModel,level);
    if (spatialResolution != S2SpatialResolution.R10M) {
      System.err.println("String_Node_Str");
      return createScaledImage(opImage,spatialResolution,level);
    }
    System.err.println("String_Node_Str");
    return opImage;
  }
 else {
    int targetWidth=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].width,level);
    int targetHeight=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].height,level);
    Dimension targetTileDim=getTileDimAtResolutionLevel(L1C_TILE_LAYOUTS[0].tileWidth,L1C_TILE_LAYOUTS[0].tileHeight,level);
    SampleModel sampleModel=ImageUtils.createSingleBandedSampleModel(S2Config.SAMPLE_DATA_BUFFER_TYPE,targetWidth,targetHeight);
    ImageLayout imageLayout=new ImageLayout(0,0,targetWidth,targetHeight,0,0,targetTileDim.width,targetTileDim.height,sampleModel,null);
    return ConstantDescriptor.create((float)imageLayout.getWidth(null),(float)imageLayout.getHeight(null),new Short[]{S2Config.FILL_CODE_NO_FILE},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  }
}

Fixed version (ground truth):
static PlanarImage create(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,S2SpatialResolution spatialResolution,int level){
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  Assert.notNull(spatialResolution,"String_Node_Str");
  if (imageFile != null) {
    PlanarImage opImage=new L1cTileOpImage(imageFile,cacheDir,imagePos,l1cTileLayout,imageModel,level);
    if (spatialResolution != S2SpatialResolution.R10M) {
      return createScaledImage(opImage,spatialResolution,level);
    }
    return opImage;
  }
 else {
    int targetWidth=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].width,level);
    int targetHeight=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].height,level);
    Dimension targetTileDim=getTileDimAtResolutionLevel(L1C_TILE_LAYOUTS[0].tileWidth,L1C_TILE_LAYOUTS[0].tileHeight,level);
    SampleModel sampleModel=ImageUtils.createSingleBandedSampleModel(S2Config.SAMPLE_DATA_BUFFER_TYPE,targetWidth,targetHeight);
    ImageLayout imageLayout=new ImageLayout(0,0,targetWidth,targetHeight,0,0,targetTileDim.width,targetTileDim.height,sampleModel,null);
    return ConstantDescriptor.create((float)imageLayout.getWidth(null),(float)imageLayout.getHeight(null),new Short[]{S2Config.FILL_CODE_NO_FILE},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  }
}
Program: 170398
Project: 170398
Buggy source:
private void decompressTile(final File outputFile,int jp2TileX,int jp2TileY) throws IOException {
  final int tileIndex=l1cTileLayout.numXTiles * jp2TileY + jp2TileX;
  ProcessBuilder builder=new ProcessBuilder(S2Config.OPJ_DECOMPRESSOR_EXE,"String_Node_Str",imageFile.getPath(),"String_Node_Str",outputFile.getPath(),"String_Node_Str",getLevel() + "String_Node_Str","String_Node_Str",tileIndex + "String_Node_Str");
  final Process process=builder.directory(cacheDir).start();
  System.err.println(builder.command());
  try {
    final int exitCode=process.waitFor();
    if (exitCode != 0) {
      System.err.println("String_Node_Str" + exitCode);
    }
  }
 catch (  InterruptedException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private void decompressTile(final File outputFile,int jp2TileX,int jp2TileY) throws IOException {
  final int tileIndex=l1cTileLayout.numXTiles * jp2TileY + jp2TileX;
  ProcessBuilder builder=null;
  if (SystemUtils.IS_OS_WINDOWS) {
    String inputFileName=Utils.GetShortPathName(imageFile.getPath());
    String outputFileName=outputFile.getPath();
    builder=new ProcessBuilder(S2Config.OPJ_DECOMPRESSOR_EXE,"String_Node_Str",inputFileName,"String_Node_Str",outputFileName,"String_Node_Str",getLevel() + "String_Node_Str","String_Node_Str",tileIndex + "String_Node_Str");
  }
 else {
    builder=new ProcessBuilder(S2Config.OPJ_DECOMPRESSOR_EXE,"String_Node_Str",imageFile.getPath(),"String_Node_Str",outputFile.getPath(),"String_Node_Str",getLevel() + "String_Node_Str","String_Node_Str",tileIndex + "String_Node_Str");
  }
  final Process process=builder.directory(cacheDir).start();
  System.err.println(builder.command());
  try {
    final int exitCode=process.waitFor();
    if (exitCode != 0) {
      System.err.println("String_Node_Str" + exitCode);
    }
  }
 catch (  InterruptedException e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}
Program: 170400
Project: 170400
Buggy source:
static Dimension getTileDim(int width,int height){
  return new Dimension(width < S2Config.DEFAULT_TILE_SIZE ? width : S2Config.DEFAULT_TILE_SIZE,height < S2Config.DEFAULT_TILE_SIZE ? height : S2Config.DEFAULT_TILE_SIZE);
}

Fixed version (ground truth):
static Dimension getTileDim(int width,int height){
  return new Dimension(width < S2Config.DEFAULT_JAI_TILE_SIZE ? width : S2Config.DEFAULT_JAI_TILE_SIZE,height < S2Config.DEFAULT_JAI_TILE_SIZE ? height : S2Config.DEFAULT_JAI_TILE_SIZE);
}
Program: 170401
Project: 170401
Buggy source:
L1cTileOpImage(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,int level){
  super(S2Config.DATA_BUFFER_TYPE,imagePos,l1cTileLayout.width,l1cTileLayout.height,getTileDimAtResolutionLevel(l1cTileLayout.tileWidth,l1cTileLayout.tileHeight,level),null,ResolutionLevel.create(imageModel,level));
  Assert.notNull(imageFile,"String_Node_Str");
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  this.imageFile=imageFile;
  this.cacheDir=cacheDir;
  this.l1cTileLayout=l1cTileLayout;
  this.openFiles=new HashMap<File,Jp2File>();
  this.locks=new HashMap<File,Object>();
}

Fixed version (ground truth):
L1cTileOpImage(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,int level){
  super(S2Config.SAMPLE_DATA_BUFFER_TYPE,imagePos,l1cTileLayout.width,l1cTileLayout.height,getTileDimAtResolutionLevel(l1cTileLayout.tileWidth,l1cTileLayout.tileHeight,level),null,ResolutionLevel.create(imageModel,level));
  Assert.notNull(imageFile,"String_Node_Str");
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  this.imageFile=imageFile;
  this.cacheDir=cacheDir;
  this.l1cTileLayout=l1cTileLayout;
  this.openFiles=new HashMap<File,Jp2File>();
  this.locks=new HashMap<File,Object>();
}
Program: 170402
Project: 170402
Buggy source:
static PlanarImage create(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,S2SpatialResolution spatialResolution,int level){
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  Assert.notNull(spatialResolution,"String_Node_Str");
  if (imageFile != null) {
    PlanarImage opImage=new L1cTileOpImage(imageFile,cacheDir,imagePos,l1cTileLayout,imageModel,level);
    if (spatialResolution != S2SpatialResolution.R10M) {
      return createScaledImage(opImage,spatialResolution,level);
    }
    return opImage;
  }
 else {
    int targetWidth=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].width,level);
    int targetHeight=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].height,level);
    Dimension targetTileDim=getTileDimAtResolutionLevel(L1C_TILE_LAYOUTS[0].tileWidth,L1C_TILE_LAYOUTS[0].tileHeight,level);
    SampleModel sampleModel=ImageUtils.createSingleBandedSampleModel(S2Config.DATA_BUFFER_TYPE,targetWidth,targetHeight);
    ImageLayout imageLayout=new ImageLayout(0,0,targetWidth,targetHeight,0,0,targetTileDim.width,targetTileDim.height,sampleModel,null);
    return ConstantDescriptor.create((float)imageLayout.getWidth(null),(float)imageLayout.getHeight(null),new Short[]{S2Config.FILL_CODE_NO_FILE},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  }
}

Fixed version (ground truth):
static PlanarImage create(File imageFile,File cacheDir,Point imagePos,L1cTileLayout l1cTileLayout,MultiLevelModel imageModel,S2SpatialResolution spatialResolution,int level){
  Assert.notNull(cacheDir,"String_Node_Str");
  Assert.notNull(l1cTileLayout,"String_Node_Str");
  Assert.notNull(imageModel,"String_Node_Str");
  Assert.notNull(spatialResolution,"String_Node_Str");
  if (imageFile != null) {
    PlanarImage opImage=new L1cTileOpImage(imageFile,cacheDir,imagePos,l1cTileLayout,imageModel,level);
    if (spatialResolution != S2SpatialResolution.R10M) {
      return createScaledImage(opImage,spatialResolution,level);
    }
    return opImage;
  }
 else {
    int targetWidth=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].width,level);
    int targetHeight=getSizeAtResolutionLevel(L1C_TILE_LAYOUTS[0].height,level);
    Dimension targetTileDim=getTileDimAtResolutionLevel(L1C_TILE_LAYOUTS[0].tileWidth,L1C_TILE_LAYOUTS[0].tileHeight,level);
    SampleModel sampleModel=ImageUtils.createSingleBandedSampleModel(S2Config.SAMPLE_DATA_BUFFER_TYPE,targetWidth,targetHeight);
    ImageLayout imageLayout=new ImageLayout(0,0,targetWidth,targetHeight,0,0,targetTileDim.width,targetTileDim.height,sampleModel,null);
    return ConstantDescriptor.create((float)imageLayout.getWidth(null),(float)imageLayout.getHeight(null),new Short[]{S2Config.FILL_CODE_NO_FILE},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  }
}
Program: 170405
Project: 170405
Buggy source:
@Override protected RenderedImage createImage(int level){
  ArrayList<RenderedImage> tileImages=new ArrayList<RenderedImage>();
  for (  String tileId : sceneDescription.getTileIds()) {
    int tileIndex=sceneDescription.getTileIndex(tileId);
    Rectangle tileRectangle=sceneDescription.getTileRectangle(tileIndex);
    PlanarImage opImage=createL1cTileImage(tileId,level);
    opImage=TranslateDescriptor.create(opImage,(float)(tileRectangle.x >> level),(float)(tileRectangle.y >> level),Interpolation.getInstance(Interpolation.INTERP_NEAREST),null);
    tileImages.add(opImage);
  }
  if (tileImages.isEmpty()) {
    return null;
  }
  ImageLayout imageLayout=new ImageLayout();
  imageLayout.setMinX(0);
  imageLayout.setMinY(0);
  imageLayout.setTileWidth(DEFAULT_TILE_SIZE);
  imageLayout.setTileHeight(DEFAULT_TILE_SIZE);
  imageLayout.setTileGridXOffset(0);
  imageLayout.setTileGridYOffset(0);
  RenderedOp mosaicOp=MosaicDescriptor.create(tileImages.toArray(new RenderedImage[tileImages.size()]),MosaicDescriptor.MOSAIC_TYPE_OVERLAY,null,null,new double[][]{{1.0}},new double[]{FILL_CODE_MOSAIC_BG},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  System.out.printf("String_Node_Str",level,mosaicOp.getMinX(),mosaicOp.getMinY());
  return mosaicOp;
}

Fixed version (ground truth):
@Override protected RenderedImage createImage(int level){
  ArrayList<RenderedImage> tileImages=new ArrayList<RenderedImage>();
  for (  String tileId : sceneDescription.getTileIds()) {
    int tileIndex=sceneDescription.getTileIndex(tileId);
    Rectangle tileRectangle=sceneDescription.getTileRectangle(tileIndex);
    PlanarImage opImage=createL1cTileImage(tileId,level);
    opImage=TranslateDescriptor.create(opImage,(float)(tileRectangle.x >> level),(float)(tileRectangle.y >> level),Interpolation.getInstance(Interpolation.INTERP_NEAREST),null);
    tileImages.add(opImage);
  }
  if (tileImages.isEmpty()) {
    return null;
  }
  ImageLayout imageLayout=new ImageLayout();
  imageLayout.setMinX(0);
  imageLayout.setMinY(0);
  imageLayout.setTileWidth(DEFAULT_JAI_TILE_SIZE);
  imageLayout.setTileHeight(DEFAULT_JAI_TILE_SIZE);
  imageLayout.setTileGridXOffset(0);
  imageLayout.setTileGridYOffset(0);
  RenderedOp mosaicOp=MosaicDescriptor.create(tileImages.toArray(new RenderedImage[tileImages.size()]),MosaicDescriptor.MOSAIC_TYPE_OVERLAY,null,null,new double[][]{{1.0}},new double[]{FILL_CODE_MOSAIC_BG},new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
  System.out.printf("String_Node_Str",level,mosaicOp.getMinX(),mosaicOp.getMinY());
  return mosaicOp;
}
Program: 170406
Project: 170406
Buggy source:
private Band addBand(Product product,BandInfo bandInfo){
  final Band band=product.addBand(bandInfo.wavebandInfo.bandName,SAMPLE_DATA_TYPE);
  band.setSpectralBandIndex(bandInfo.bandIndex);
  band.setSpectralWavelength((float)bandInfo.wavebandInfo.wavelength);
  band.setSpectralBandwidth((float)bandInfo.wavebandInfo.bandwidth);
  band.setSolarFlux((float)bandInfo.wavebandInfo.solarIrradiance);
  return band;
}

Fixed version (ground truth):
private Band addBand(Product product,BandInfo bandInfo){
  final Band band=product.addBand(bandInfo.wavebandInfo.bandName,SAMPLE_PRODUCT_DATA_TYPE);
  band.setSpectralBandIndex(bandInfo.bandIndex);
  band.setSpectralWavelength((float)bandInfo.wavebandInfo.wavelength);
  band.setSpectralBandwidth((float)bandInfo.wavebandInfo.bandwidth);
  band.setSolarFlux((float)bandInfo.wavebandInfo.solarIrradiance);
  return band;
}
Program: 170409
Project: 170409
Buggy source:
@Test public void testScaleSourceImage(){
  Band targetBand=new Band("String_Node_Str",ProductData.TYPE_INT32,200,200);
  int levelCount=5;
  MultiLevelImage sourceImage=createSourceImage(levelCount,100,100);
  float[] scalings=new float[]{((float)targetBand.getRasterWidth()) / sourceImage.getWidth(),((float)targetBand.getRasterHeight()) / sourceImage.getHeight()};
  float[] translationsBeforeScaling=new float[]{0f,0f};
  final RenderingHints renderingHints=new RenderingHints(JAI.KEY_BORDER_EXTENDER,BorderExtender.createInstance(BorderExtender.BORDER_COPY));
  MultiLevelImage scaledImage=SourceImageScaler.scaleMultiLevelImage(targetBand.getSourceImage(),sourceImage,scalings,translationsBeforeScaling,new float[]{0f,0f},renderingHints,Double.NaN,Interpolation.getInstance(Interpolation.INTERP_NEAREST));
  final Rectangle targetBounds=targetBand.getSourceImage().getBounds();
  assertEquals(targetBand.getRasterWidth(),scaledImage.getWidth());
  assertEquals(targetBand.getRasterHeight(),scaledImage.getHeight());
  assertEquals(targetBand.getSourceImage().getModel().getLevelCount(),scaledImage.getModel().getLevelCount());
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(0,0,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(targetBounds.width - 1,0,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(0,targetBounds.height - 1,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(targetBounds.width - 1,targetBounds.height - 1,0));
}

Fixed version (ground truth):
@Test public void testScaleSourceImage(){
  MultiLevelImage sourceImage=createSourceImage(levelCount,100,100);
  MultiLevelImage scaledImage=SourceImageScaler.scaleMultiLevelImage(targetBand.getSourceImage(),sourceImage,scalings,translationsBeforeScaling,new float[]{0f,0f},renderingHints,Double.NaN,Interpolation.getInstance(Interpolation.INTERP_NEAREST));
  final Rectangle targetBounds=targetBand.getSourceImage().getBounds();
  assertEquals(targetBand.getRasterWidth(),scaledImage.getWidth());
  assertEquals(targetBand.getRasterHeight(),scaledImage.getHeight());
  assertEquals(targetBand.getSourceImage().getModel().getLevelCount(),scaledImage.getModel().getLevelCount());
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(0,0,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(targetBounds.width - 1,0,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(0,targetBounds.height - 1,0));
  assertEquals(MAX_USHORT,scaledImage.getData().getSample(targetBounds.width - 1,targetBounds.height - 1,0));
}
Program: 170410
Project: 170410
Buggy source:
/** 
 * Create a new Variant with a given value.
 * @param value the value this Variant holds.
 */
public Variant(@Nullable Object value){
  if (value != null) {
    Class<?> clazz=value.getClass().isArray() ? ArrayUtil.getType(value) : value.getClass();
    checkArgument(clazz.isArray() || !Variant.class.equals(clazz),"String_Node_Str");
    checkArgument(!DataValue.class.equals(clazz),"String_Node_Str");
    checkArgument(!DiagnosticInfo.class.equals(clazz),"String_Node_Str");
  }
  this.value=value;
}

Fixed version (ground truth):
/** 
 * Create a new Variant with a given value.
 * @param value the value this Variant holds.
 */
public Variant(@Nullable Object value){
  if (value != null) {
    boolean clazzIsArray=value.getClass().isArray();
    Class<?> componentClazz=clazzIsArray ? ArrayUtil.getType(value) : value.getClass();
    checkArgument(clazzIsArray || !Variant.class.equals(componentClazz),"String_Node_Str");
    checkArgument(!DataValue.class.equals(componentClazz),"String_Node_Str");
    checkArgument(!DiagnosticInfo.class.equals(componentClazz),"String_Node_Str");
  }
  this.value=value;
}
Program: 170411
Project: 170411
Buggy source:
@DataProvider(name="String_Node_Str") public Object[][] getVariants(){
  return new Object[][]{{new Variant(null)},{new Variant("String_Node_Str")},{new Variant(42)},{new Variant(new Integer[]{0,1,2,3})},{new Variant(new Integer[][]{{0,1},{2,3}})},{new Variant(new Long[]{0L,1L,2L,3L})},{new Variant(new Long[][]{{0L,1L},{2L,3L}})},{new Variant(new UInteger[]{Unsigned.uint(0),Unsigned.uint(1),Unsigned.uint(2),Unsigned.uint(3)})},{new Variant(new UInteger[][]{{Unsigned.uint(0),Unsigned.uint(1)},{Unsigned.uint(2),Unsigned.uint(3)}})}};
}

Fixed version (ground truth):
@DataProvider(name="String_Node_Str") public Object[][] getVariants(){
  return new Object[][]{{new Variant(null)},{new Variant("String_Node_Str")},{new Variant(42)},{new Variant(new Integer[]{0,1,2,3})},{new Variant(new Integer[][]{{0,1},{2,3}})},{new Variant(new Long[]{0L,1L,2L,3L})},{new Variant(new Long[][]{{0L,1L},{2L,3L}})},{new Variant(new UInteger[]{Unsigned.uint(0),Unsigned.uint(1),Unsigned.uint(2),Unsigned.uint(3)})},{new Variant(new UInteger[][]{{Unsigned.uint(0),Unsigned.uint(1)},{Unsigned.uint(2),Unsigned.uint(3)}})},{new Variant(new Variant[]{new Variant(0),new Variant(1),new Variant(2)})}};
}
Program: 170412
Project: 170412
Buggy source:
private void onError(ChannelHandlerContext ctx,ByteBuf buffer){
  try {
    ErrorMessage error=TcpMessageDecoder.decodeError(buffer);
    if (error.getError() == StatusCodes.Bad_TcpSecureChannelUnknown || error.getError() == StatusCodes.Bad_SecureChannelIdInvalid) {
      secureChannel.setChannelId(0);
    }
    logger.error("String_Node_Str" + error);
  }
 catch (  UaException e) {
    logger.error("String_Node_Str",e.getMessage(),e);
  }
 finally {
    ctx.close();
  }
}

Fixed version (ground truth):
private void onError(ChannelHandlerContext ctx,ByteBuf buffer){
  try {
    ErrorMessage error=TcpMessageDecoder.decodeError(buffer);
    if (error.getError().getValue() == StatusCodes.Bad_TcpSecureChannelUnknown || error.getError().getValue() == StatusCodes.Bad_SecureChannelIdInvalid) {
      secureChannel.setChannelId(0);
    }
    logger.error("String_Node_Str" + error);
  }
 catch (  UaException e) {
    logger.error("String_Node_Str",e.getMessage(),e);
  }
 finally {
    ctx.close();
  }
}