nus-yam/ex-repair huggingface dataset:
Program: 93431
Project: 93431
Buggy source:
private void computeImageMatrix(){
  final int viewWidth=getWidth() - getPaddingLeft() - getPaddingRight();
  final int viewHeight=getHeight() - getPaddingTop() - getPaddingBottom();
  if (cropType != CropType.NONE && viewHeight > 0 && viewWidth > 0) {
    final Matrix matrix=getImageMatrix();
    int drawableWidth=getDrawable().getIntrinsicWidth();
    int drawableHeight=getDrawable().getIntrinsicHeight();
    final float scaleY=(float)viewHeight / (float)drawableHeight;
    final float scaleX=(float)viewWidth / (float)drawableWidth;
    final float scale=scaleX > scaleY ? scaleX : scaleY;
    matrix.setScale(scale,scale);
    final boolean verticalImageMode=scaleX > scaleY;
    final float xTranslation=getXTranslation(cropType,scale,viewWidth,drawableWidth,verticalImageMode);
    final float yTranslation=getYTranslation(cropType,scale,viewHeight,drawableHeight,verticalImageMode);
    matrix.postTranslate(xTranslation,yTranslation);
    setImageMatrix(matrix);
  }
}

Fixed version (ground truth):
private void computeImageMatrix(){
  final int viewWidth=getWidth() - getPaddingLeft() - getPaddingRight();
  final int viewHeight=getHeight() - getPaddingTop() - getPaddingBottom();
  if (cropType != CropType.NONE && viewHeight > 0 && viewWidth > 0) {
    final Matrix matrix=getImageMatrix();
    int drawableWidth=getDrawable().getIntrinsicWidth();
    int drawableHeight=getDrawable().getIntrinsicHeight();
    final float scaleY=(float)viewHeight / (float)drawableHeight;
    final float scaleX=(float)viewWidth / (float)drawableWidth;
    final float scale=scaleX > scaleY ? scaleX : scaleY;
    matrix.setScale(scale,scale);
    final boolean verticalImageMode=scaleX > scaleY;
    final float postDrawableWidth=drawableWidth * scale;
    final float xTranslation=getXTranslation(cropType,viewWidth,postDrawableWidth,verticalImageMode);
    final float postDrawabeHeigth=drawableHeight * scale;
    final float yTranslation=getYTranslation(cropType,viewHeight,postDrawabeHeigth,verticalImageMode);
    matrix.postTranslate(xTranslation,yTranslation);
    setImageMatrix(matrix);
  }
}
Program: 93432
Project: 93432
Buggy source:
private void initData(){
  this.pagerView.setAdapter(new CropImageAdapter());
  this.indicatorView.setViewPager(this.pagerView);
  this.indicatorView.setOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int i,    float v,    int i2){
    }
    @Override public void onPageSelected(    int i){
    }
    @Override public void onPageScrollStateChanged(    int i){
    }
  }
);
}

Fixed version (ground truth):
private void initData(){
  this.pagerView.setAdapter(new CropImageAdapter());
  final int pagerMargin=getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
  this.pagerView.setPageMargin(pagerMargin);
  this.indicatorView.setViewPager(this.pagerView);
  this.indicatorView.setOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int i,    float v,    int i2){
    }
    @Override public void onPageSelected(    int i){
    }
    @Override public void onPageScrollStateChanged(    int i){
    }
  }
);
}
Program: 93433
Project: 93433
Buggy source:
@Override public Object instantiateItem(ViewGroup container,int position){
  CropImageView cropImageView=new CropImageView(CropActivity.this);
  cropImageView.setImageDrawable(getResources().getDrawable(images[position]));
  final CropImageView.CropType cropType=imageCrops[position];
  cropImageView.setId(cropType.getCrop());
  cropImageView.setCropType(cropType);
  final int matchParent=ViewGroup.LayoutParams.MATCH_PARENT;
  FrameLayout.LayoutParams imageParams=new FrameLayout.LayoutParams(matchParent,matchParent);
  container.addView(cropImageView,imageParams);
  return cropImageView;
}

Fixed version (ground truth):
@Override public Object instantiateItem(ViewGroup container,int position){
  ForegroundImageView cropImageView=new ForegroundImageView(CropActivity.this);
  final Resources res=getResources();
  cropImageView.setImageDrawable(res.getDrawable(images[position]));
  cropImageView.setForeground(res.getDrawable(R.drawable.shape_grad_black_transp_70));
  final CropImageView.CropType cropType=imageCrops[position];
  cropImageView.setCropType(cropType);
  cropImageView.setId(cropType.getCrop());
  final int matchParent=ViewGroup.LayoutParams.MATCH_PARENT;
  FrameLayout.LayoutParams imageParams=new FrameLayout.LayoutParams(matchParent,matchParent);
  container.addView(cropImageView,imageParams);
  return cropImageView;
}
Program: 93434
Project: 93434
Buggy source:
/** 
 * Generate the mac based on HMAC_ALGORITHM
 * @param integrityKey The key used for hmac
 * @param byteCipherText the cipher text
 * @return A byte array of the HMAC for the given key & ciphertext
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeyException
 */
public static byte[] generateMac(byte[] byteCipherText,SecretKey integrityKey) throws NoSuchAlgorithmException, InvalidKeyException {
  Mac sha256_HMAC=Mac.getInstance(HMAC_ALGORITHM);
  sha256_HMAC.init(integrityKey);
  return sha256_HMAC.doFinal(byteCipherText);
}

Fixed version (ground truth):
/** 
 * Generate the mac based on HMAC_ALGORITHM
 * @param integrityKey The key used for hmac
 * @param byteCipherText the cipher text
 * @return A byte array of the HMAC for the given key and ciphertext
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeyException
 */
public static byte[] generateMac(byte[] byteCipherText,SecretKey integrityKey) throws NoSuchAlgorithmException, InvalidKeyException {
  Mac sha256_HMAC=Mac.getInstance(HMAC_ALGORITHM);
  sha256_HMAC.init(integrityKey);
  return sha256_HMAC.doFinal(byteCipherText);
}
Program: 93435
Project: 93435
Buggy source:
/** 
 * An aes key derived from a base64 encoded key. This does not generate the key. It's not random or a PBE key.
 * @param keysStr a base64 encoded AES key / hmac key as base64(aesKey) : base64(hmacKey).
 * @return an AES & HMAC key set suitable for other functions.
 */
public static SecretKeys keys(String keysStr) throws InvalidKeyException {
  String[] keysArr=keysStr.split("String_Node_Str");
  if (keysArr.length != 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else {
    byte[] confidentialityKey=Base64.decode(keysArr[0],BASE64_FLAGS);
    if (confidentialityKey.length != AES_KEY_LENGTH_BITS / 8) {
      throw new InvalidKeyException("String_Node_Str" + AES_KEY_LENGTH_BITS + "String_Node_Str");
    }
    byte[] integrityKey=Base64.decode(keysArr[1],BASE64_FLAGS);
    if (integrityKey.length != HMAC_KEY_LENGTH_BITS / 8) {
      throw new InvalidKeyException("String_Node_Str" + HMAC_KEY_LENGTH_BITS + "String_Node_Str");
    }
    return new SecretKeys(new SecretKeySpec(confidentialityKey,0,confidentialityKey.length,CIPHER),new SecretKeySpec(integrityKey,HMAC_ALGORITHM));
  }
}

Fixed version (ground truth):
/** 
 * An aes key derived from a base64 encoded key. This does not generate the key. It's not random or a PBE key.
 * @param keysStr a base64 encoded AES key / hmac key as base64(aesKey) : base64(hmacKey).
 * @return an AES and HMAC key set suitable for other functions.
 */
public static SecretKeys keys(String keysStr) throws InvalidKeyException {
  String[] keysArr=keysStr.split("String_Node_Str");
  if (keysArr.length != 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else {
    byte[] confidentialityKey=Base64.decode(keysArr[0],BASE64_FLAGS);
    if (confidentialityKey.length != AES_KEY_LENGTH_BITS / 8) {
      throw new InvalidKeyException("String_Node_Str" + AES_KEY_LENGTH_BITS + "String_Node_Str");
    }
    byte[] integrityKey=Base64.decode(keysArr[1],BASE64_FLAGS);
    if (integrityKey.length != HMAC_KEY_LENGTH_BITS / 8) {
      throw new InvalidKeyException("String_Node_Str" + HMAC_KEY_LENGTH_BITS + "String_Node_Str");
    }
    return new SecretKeys(new SecretKeySpec(confidentialityKey,0,confidentialityKey.length,CIPHER),new SecretKeySpec(integrityKey,HMAC_ALGORITHM));
  }
}
Program: 93436
Project: 93436
Buggy source:
/** 
 * Generates a random IV and encrypts this plain text with the given key. Then attaches a hashed MAC, which is contained in the CipherTextIvMac class.
 * @param plaintext The text that will be encrypted
 * @param secretKeys The combined AES & HMAC keys with which to encrypt
 * @return a tuple of the IV, ciphertext, mac
 * @throws GeneralSecurityException if AES is not implemented on this system
 */
public static CipherTextIvMac encrypt(byte[] plaintext,SecretKeys secretKeys) throws GeneralSecurityException {
  byte[] iv=generateIv();
  Cipher aesCipherForEncryption=Cipher.getInstance(CIPHER_TRANSFORMATION);
  aesCipherForEncryption.init(Cipher.ENCRYPT_MODE,secretKeys.getConfidentialityKey(),new IvParameterSpec(iv));
  iv=aesCipherForEncryption.getIV();
  byte[] byteCipherText=aesCipherForEncryption.doFinal(plaintext);
  byte[] ivCipherConcat=CipherTextIvMac.ivCipherConcat(iv,byteCipherText);
  byte[] integrityMac=generateMac(ivCipherConcat,secretKeys.getIntegrityKey());
  return new CipherTextIvMac(byteCipherText,iv,integrityMac);
}

Fixed version (ground truth):
/** 
 * Generates a random IV and encrypts this plain text with the given key. Then attaches a hashed MAC, which is contained in the CipherTextIvMac class.
 * @param plaintext The text that will be encrypted
 * @param secretKeys The combined AES and HMAC keys with which to encrypt
 * @return a tuple of the IV, ciphertext, mac
 * @throws GeneralSecurityException if AES is not implemented on this system
 */
public static CipherTextIvMac encrypt(byte[] plaintext,SecretKeys secretKeys) throws GeneralSecurityException {
  byte[] iv=generateIv();
  Cipher aesCipherForEncryption=Cipher.getInstance(CIPHER_TRANSFORMATION);
  aesCipherForEncryption.init(Cipher.ENCRYPT_MODE,secretKeys.getConfidentialityKey(),new IvParameterSpec(iv));
  iv=aesCipherForEncryption.getIV();
  byte[] byteCipherText=aesCipherForEncryption.doFinal(plaintext);
  byte[] ivCipherConcat=CipherTextIvMac.ivCipherConcat(iv,byteCipherText);
  byte[] integrityMac=generateMac(ivCipherConcat,secretKeys.getIntegrityKey());
  return new CipherTextIvMac(byteCipherText,iv,integrityMac);
}
Program: 93437
Project: 93437
Buggy source:
/** 
 * A function that generates password-based AES & HMAC keys. See generateKeyFromPassword.
 * @param password The password to derive the AES/HMAC keys from
 * @param salt A string version of the salt; base64 encoded.
 * @return The AES & HMAC keys.
 * @throws GeneralSecurityException
 */
public static SecretKeys generateKeyFromPassword(String password,String salt) throws GeneralSecurityException {
  return generateKeyFromPassword(password,Base64.decode(salt,BASE64_FLAGS));
}

Fixed version (ground truth):
/** 
 * A function that generates password-based AES and HMAC keys. See generateKeyFromPassword.
 * @param password The password to derive the AES/HMAC keys from
 * @param salt A string version of the salt; base64 encoded.
 * @return The AES and HMAC keys.
 * @throws GeneralSecurityException
 */
public static SecretKeys generateKeyFromPassword(String password,String salt) throws GeneralSecurityException {
  return generateKeyFromPassword(password,Base64.decode(salt,BASE64_FLAGS));
}
Program: 93438
Project: 93438
Buggy source:
/** 
 * Converts the given AES/HMAC keys into a base64 encoded string suitable for storage. Sister function of keys.
 * @param keys The combined aes and hmac keys
 * @return a base 64 encoded AES string & hmac key as base64(aesKey) : base64(hmacKey)
 */
public static String keyString(SecretKeys keys){
  return keys.toString();
}

Fixed version (ground truth):
/** 
 * Converts the given AES/HMAC keys into a base64 encoded string suitable for storage. Sister function of keys.
 * @param keys The combined aes and hmac keys
 * @return a base 64 encoded AES string and hmac key as base64(aesKey) : base64(hmacKey)
 */
public static String keyString(SecretKeys keys){
  return keys.toString();
}
Program: 93439
Project: 93439
Buggy source:
/** 
 * AES CBC decrypt.
 * @param civ The cipher text, IV, and mac
 * @param secretKeys The AES & HMAC keys
 * @return A string derived from the decrypted bytes, which are interpretedas a UTF-8 String
 * @throws GeneralSecurityException if AES is not implemented on this system
 * @throws UnsupportedEncodingException if UTF-8 is not supported
 */
public static String decryptString(CipherTextIvMac civ,SecretKeys secretKeys) throws UnsupportedEncodingException, GeneralSecurityException {
  return decryptString(civ,secretKeys,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * AES CBC decrypt.
 * @param civ The cipher text, IV, and mac
 * @param secretKeys The AES and HMAC keys
 * @return A string derived from the decrypted bytes, which are interpretedas a UTF-8 String
 * @throws GeneralSecurityException if AES is not implemented on this system
 * @throws UnsupportedEncodingException if UTF-8 is not supported
 */
public static String decryptString(CipherTextIvMac civ,SecretKeys secretKeys) throws UnsupportedEncodingException, GeneralSecurityException {
  return decryptString(civ,secretKeys,"String_Node_Str");
}
Program: 93440
Project: 93440
Buggy source:
/** 
 * A function that generates random AES & HMAC keys and prints out exceptions but doesn't throw them since none should be encountered. If they are encountered, the return value is null.
 * @return The AES & HMAC keys.
 * @throws GeneralSecurityException if AES is not implemented on this system,or a suitable RNG is not available
 */
public static SecretKeys generateKey() throws GeneralSecurityException {
  fixPrng();
  KeyGenerator keyGen=KeyGenerator.getInstance(CIPHER);
  keyGen.init(AES_KEY_LENGTH_BITS);
  SecretKey confidentialityKey=keyGen.generateKey();
  byte[] integrityKeyBytes=randomBytes(HMAC_KEY_LENGTH_BITS / 8);
  SecretKey integrityKey=new SecretKeySpec(integrityKeyBytes,HMAC_ALGORITHM);
  return new SecretKeys(confidentialityKey,integrityKey);
}

Fixed version (ground truth):
/** 
 * A function that generates random AES and HMAC keys and prints out exceptions but doesn't throw them since none should be encountered. If they are encountered, the return value is null.
 * @return The AES and HMAC keys.
 * @throws GeneralSecurityException if AES is not implemented on this system,or a suitable RNG is not available
 */
public static SecretKeys generateKey() throws GeneralSecurityException {
  fixPrng();
  KeyGenerator keyGen=KeyGenerator.getInstance(CIPHER);
  keyGen.init(AES_KEY_LENGTH_BITS);
  SecretKey confidentialityKey=keyGen.generateKey();
  byte[] integrityKeyBytes=randomBytes(HMAC_KEY_LENGTH_BITS / 8);
  SecretKey integrityKey=new SecretKeySpec(integrityKeyBytes,HMAC_ALGORITHM);
  return new SecretKeys(confidentialityKey,integrityKey);
}
Program: 93441
Project: 93441
Buggy source:
/** 
 * AES CBC decrypt.
 * @param civ the cipher text, iv, and mac
 * @param secretKeys the AES & HMAC keys
 * @return The raw decrypted bytes
 * @throws GeneralSecurityException if MACs don't match or AES is not implemented
 */
public static byte[] decrypt(CipherTextIvMac civ,SecretKeys secretKeys) throws GeneralSecurityException {
  byte[] ivCipherConcat=CipherTextIvMac.ivCipherConcat(civ.getIv(),civ.getCipherText());
  byte[] computedMac=generateMac(ivCipherConcat,secretKeys.getIntegrityKey());
  if (constantTimeEq(computedMac,civ.getMac())) {
    Cipher aesCipherForDecryption=Cipher.getInstance(CIPHER_TRANSFORMATION);
    aesCipherForDecryption.init(Cipher.DECRYPT_MODE,secretKeys.getConfidentialityKey(),new IvParameterSpec(civ.getIv()));
    return aesCipherForDecryption.doFinal(civ.getCipherText());
  }
 else {
    throw new GeneralSecurityException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * AES CBC decrypt.
 * @param civ the cipher text, iv, and mac
 * @param secretKeys the AES and HMAC keys
 * @return The raw decrypted bytes
 * @throws GeneralSecurityException if MACs don't match or AES is not implemented
 */
public static byte[] decrypt(CipherTextIvMac civ,SecretKeys secretKeys) throws GeneralSecurityException {
  byte[] ivCipherConcat=CipherTextIvMac.ivCipherConcat(civ.getIv(),civ.getCipherText());
  byte[] computedMac=generateMac(ivCipherConcat,secretKeys.getIntegrityKey());
  if (constantTimeEq(computedMac,civ.getMac())) {
    Cipher aesCipherForDecryption=Cipher.getInstance(CIPHER_TRANSFORMATION);
    aesCipherForDecryption.init(Cipher.DECRYPT_MODE,secretKeys.getConfidentialityKey(),new IvParameterSpec(civ.getIv()));
    return aesCipherForDecryption.doFinal(civ.getCipherText());
  }
 else {
    throw new GeneralSecurityException("String_Node_Str");
  }
}
Program: 93444
Project: 93444
Buggy source:
private void sendBinaryContent(final GridFSBucket gridFSBucket,final GridFSFile file,final HttpServerExchange exchange) throws IOException {
  LOGGER.trace("String_Node_Str",file.getFilename());
  LOGGER.trace("String_Node_Str",file.getLength());
  if (file.getMetadata() != null && file.getMetadata().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getMetadata().get("String_Node_Str").toString());
  }
 else   if (file.getExtraElements() != null && file.getExtraElements().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getExtraElements().get("String_Node_Str").toString());
  }
 else {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,APPLICATION_OCTET_STREAM);
  }
  exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,file.getLength());
  exchange.getResponseHeaders().put(Headers.CONTENT_DISPOSITION,String.format("String_Node_Str",extractFilename(file)));
  exchange.getResponseHeaders().put(Headers.CONTENT_TRANSFER_ENCODING,CONTENT_TRANSFER_ENCODING_BINARY);
  ResponseHelper.injectEtagHeader(exchange,file.getMetadata());
  exchange.setStatusCode(HttpStatus.SC_OK);
  gridFSBucket.downloadToStream(file.getId(),exchange.getOutputStream());
  exchange.endExchange();
}

Fixed version (ground truth):
private void sendBinaryContent(final RequestContext context,final GridFSBucket gridFSBucket,final GridFSFile file,final HttpServerExchange exchange) throws IOException {
  LOGGER.trace("String_Node_Str",file.getFilename());
  LOGGER.trace("String_Node_Str",file.getLength());
  if (file.getMetadata() != null && file.getMetadata().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getMetadata().get("String_Node_Str").toString());
  }
 else   if (file.getMetadata() != null && file.getMetadata().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getMetadata().get("String_Node_Str").toString());
  }
 else {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,APPLICATION_OCTET_STREAM);
  }
  exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,file.getLength());
  exchange.getResponseHeaders().put(Headers.CONTENT_DISPOSITION,String.format("String_Node_Str",extractFilename(file)));
  exchange.getResponseHeaders().put(Headers.CONTENT_TRANSFER_ENCODING,CONTENT_TRANSFER_ENCODING_BINARY);
  ResponseHelper.injectEtagHeader(exchange,file.getMetadata());
  context.setResponseStatusCode(HttpStatus.SC_OK);
  gridFSBucket.downloadToStream(file.getId(),exchange.getOutputStream());
}
Program: 93445
Project: 93445
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.isInError()) {
    next(exchange,context);
    return;
  }
  LOGGER.trace("String_Node_Str" + exchange.getRequestURL());
  final String bucket=extractBucketName(context.getCollectionName());
  GridFSBucket gridFSBucket=GridFSBuckets.create(MongoDBClientSingleton.getInstance().getClient().getDatabase(context.getDBName()),bucket);
  GridFSFile dbsfile=gridFSBucket.find(eq("String_Node_Str",context.getDocumentId())).limit(1).iterator().tryNext();
  if (dbsfile == null) {
    fileNotFound(context,exchange);
  }
 else   if (!checkEtag(exchange,dbsfile)) {
    sendBinaryContent(gridFSBucket,dbsfile,exchange);
  }
  next(exchange,context);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.isInError()) {
    next(exchange,context);
    return;
  }
  LOGGER.trace("String_Node_Str" + exchange.getRequestURL());
  final String bucket=extractBucketName(context.getCollectionName());
  GridFSBucket gridFSBucket=GridFSBuckets.create(MongoDBClientSingleton.getInstance().getClient().getDatabase(context.getDBName()),bucket);
  GridFSFile dbsfile=gridFSBucket.find(eq("String_Node_Str",context.getDocumentId())).limit(1).iterator().tryNext();
  if (dbsfile == null) {
    fileNotFound(context,exchange);
  }
 else   if (!checkEtag(exchange,dbsfile)) {
    sendBinaryContent(context,gridFSBucket,dbsfile,exchange);
  }
  next(exchange,context);
}
Program: 93446
Project: 93446
Buggy source:
/** 
 * Returns the correct response generator for any given accept header. behaviour is: * by default, return prometheus format * if something else is wanted, return that (if available) * if Accept header cannot be satisfied, return 406 (NOT ACCEPTABLE)
 */
public static ResponseType forAcceptHeader(String acceptHeader){
  if (acceptHeader == null) {
    return ResponseType.PROMETHEUS;
  }
  return Arrays.stream(acceptHeader.split("String_Node_Str")).map(String::trim).map(AcceptHeaderEntry::of).filter(Objects::nonNull).sorted(new AcceptHeaderEntryComparator()).flatMap(x -> Arrays.stream(ResponseType.values()).filter(rt -> rt.isAcceptableFor(x))).findFirst().orElse(null);
}

Fixed version (ground truth):
/** 
 * Returns the correct response generator for any given accept header. behaviour is: * by default, return prometheus format * if something else is wanted, return that (if available) * if Accept header cannot be satisfied, return 406 (NOT ACCEPTABLE)
 */
public static ResponseType forAcceptHeader(String acceptHeader){
  if (acceptHeader == null || acceptHeader.equalsIgnoreCase("String_Node_Str")) {
    return ResponseType.PROMETHEUS;
  }
  return Arrays.stream(acceptHeader.split("String_Node_Str")).map(String::trim).map(AcceptHeaderEntry::of).filter(Objects::nonNull).sorted(new AcceptHeaderEntryComparator()).flatMap(x -> Arrays.stream(ResponseType.values()).filter(rt -> rt.isAcceptableFor(x))).findFirst().orElse(null);
}
Program: 93448
Project: 93448
Buggy source:
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (context.isInError()) {
    next(exchange,context);
    return;
  }
  if (doesTransformerAppy()) {
    transform(exchange,context);
  }
  next(exchange,context);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServerExchange exchange,RequestContext context) throws Exception {
  if (doesTransformerAppy()) {
    transform(exchange,context);
  }
  next(exchange,context);
}
Program: 93449
Project: 93449
Buggy source:
/** 
 * logLoggingConfiguration
 * @param fork
 */
private static void logLoggingConfiguration(boolean fork){
  if (configuration.isLogToFile()) {
    LOGGER.info("String_Node_Str",configuration.getLogFilePath(),configuration.getLogLevel());
  }
  if (!fork) {
    if (!configuration.isLogToConsole()) {
      LOGGER.info("String_Node_Str");
    }
 else {
      LOGGER.info("String_Node_Str",configuration.getLogLevel());
    }
  }
}

Fixed version (ground truth):
/** 
 * logLoggingConfiguration
 * @param fork
 */
private static void logLoggingConfiguration(boolean fork){
  String logbackConfigurationFile=System.getProperty("String_Node_Str");
  boolean usesLogback=logbackConfigurationFile != null && !logbackConfigurationFile.equals("String_Node_Str");
  if (usesLogback)   return;
  if (configuration.isLogToFile()) {
    LOGGER.info("String_Node_Str",configuration.getLogFilePath(),configuration.getLogLevel());
  }
  if (!fork) {
    if (!configuration.isLogToConsole()) {
      LOGGER.info("String_Node_Str");
    }
 else {
      LOGGER.info("String_Node_Str",configuration.getLogLevel());
    }
  }
}
Program: 93450
Project: 93450
Buggy source:
/** 
 * @return the logLevel
 */
public final Level getLogLevel(){
  return logLevel;
}

Fixed version (ground truth):
/** 
 * @return the logLevel
 */
public final Level getLogLevel(){
  String logbackConfigurationFile=System.getProperty("String_Node_Str");
  if (logbackConfigurationFile != null && !logbackConfigurationFile.equals("String_Node_Str")) {
    LoggerContext loggerContext=(LoggerContext)LoggerFactory.getILoggerFactory();
    ch.qos.logback.classic.Logger logger=loggerContext.getLogger("String_Node_Str");
    return logger.getLevel();
  }
  return logLevel;
}
Program: 93451
Project: 93451
Buggy source:
/** 
 * @param level
 */
public static void setLogLevel(Level level){
  LoggerContext loggerContext=(LoggerContext)LoggerFactory.getILoggerFactory();
  Logger logger=loggerContext.getLogger("String_Node_Str");
  logger.setLevel(level);
}

Fixed version (ground truth):
/** 
 * @param level
 */
public static void setLogLevel(Level level){
  LoggerContext loggerContext=(LoggerContext)LoggerFactory.getILoggerFactory();
  Logger logger=loggerContext.getLogger("String_Node_Str");
  String logbackConfigurationFile=System.getProperty("String_Node_Str");
  if (logbackConfigurationFile != null && !logbackConfigurationFile.equals("String_Node_Str")) {
    logger.info("String_Node_Str",logger.getLevel());
    level=logger.getLevel();
  }
  logger.setLevel(level);
}
Program: 93452
Project: 93452
Buggy source:
private void sendBinaryContent(final GridFSBucket gridFSBucket,final GridFSFile file,final HttpServerExchange exchange) throws IOException {
  LOGGER.trace("String_Node_Str",file.getFilename());
  LOGGER.trace("String_Node_Str",file.getLength());
  if (file.getMetadata() != null && file.getMetadata().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getMetadata().get("String_Node_Str").toString());
  }
 else   if (file.getExtraElements() != null && file.getExtraElements().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getExtraElements().get("String_Node_Str").toString());
  }
 else {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,APPLICATION_OCTET_STREAM);
  }
  exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,file.getLength());
  exchange.getResponseHeaders().put(Headers.CONTENT_DISPOSITION,String.format("String_Node_Str",extractFilename(file)));
  exchange.getResponseHeaders().put(Headers.CONTENT_TRANSFER_ENCODING,CONTENT_TRANSFER_ENCODING_BINARY);
  ResponseHelper.injectEtagHeader(exchange,file.getMetadata());
  exchange.setStatusCode(HttpStatus.SC_OK);
  gridFSBucket.downloadToStream(file.getId().asObjectId().getValue(),exchange.getOutputStream());
  exchange.endExchange();
}

Fixed version (ground truth):
private void sendBinaryContent(final GridFSBucket gridFSBucket,final GridFSFile file,final HttpServerExchange exchange) throws IOException {
  LOGGER.trace("String_Node_Str",file.getFilename());
  LOGGER.trace("String_Node_Str",file.getLength());
  if (file.getMetadata() != null && file.getMetadata().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getMetadata().get("String_Node_Str").toString());
  }
 else   if (file.getExtraElements() != null && file.getExtraElements().get("String_Node_Str") != null) {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,file.getExtraElements().get("String_Node_Str").toString());
  }
 else {
    exchange.getResponseHeaders().put(Headers.CONTENT_TYPE,APPLICATION_OCTET_STREAM);
  }
  exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH,file.getLength());
  exchange.getResponseHeaders().put(Headers.CONTENT_DISPOSITION,String.format("String_Node_Str",extractFilename(file)));
  exchange.getResponseHeaders().put(Headers.CONTENT_TRANSFER_ENCODING,CONTENT_TRANSFER_ENCODING_BINARY);
  ResponseHelper.injectEtagHeader(exchange,file.getMetadata());
  exchange.setStatusCode(HttpStatus.SC_OK);
  gridFSBucket.downloadToStream(file.getId(),exchange.getOutputStream());
  exchange.endExchange();
}
Program: 93453
Project: 93453
Buggy source:
/** 
 * @param jsonString
 * @return minified json string
 */
public static String minify(String jsonString){
  if (true) {
    return minifier.minify(jsonString);
  }
  boolean in_string=false;
  boolean in_multiline_comment=false;
  boolean in_singleline_comment=false;
  char string_opener='x';
  StringBuilder out=new StringBuilder();
  for (int i=0; i < jsonString.length(); i++) {
    char c=jsonString.charAt(i);
    String cc=jsonString.substring(i,Math.min(i + 2,jsonString.length()));
    if (in_string) {
      if (c == string_opener) {
        in_string=false;
        out.append(c);
      }
 else       if (c == '\\') {
        out.append(cc);
        ++i;
      }
 else {
        out.append(c);
      }
    }
 else     if (in_singleline_comment) {
      if (c == '\r' || c == '\n') {
        in_singleline_comment=false;
      }
    }
 else     if (in_multiline_comment) {
      if (cc.equals("String_Node_Str")) {
        in_multiline_comment=false;
        ++i;
      }
    }
 else     if (cc.equals("String_Node_Str")) {
      in_multiline_comment=true;
      ++i;
    }
 else     if (cc.equals("String_Node_Str")) {
      in_singleline_comment=true;
      ++i;
    }
 else     if (c == '"' || c == '\'') {
      in_string=true;
      string_opener=c;
      out.append(c);
    }
 else     if (!Character.isWhitespace(c)) {
      out.append(c);
    }
  }
  return out.toString();
}

Fixed version (ground truth):
/** 
 * @param jsonString
 * @return minified json string
 */
public static String minify(String jsonString){
  Minify minifier=new Minify();
  if (true) {
    return minifier.minify(jsonString);
  }
  boolean in_string=false;
  boolean in_multiline_comment=false;
  boolean in_singleline_comment=false;
  char string_opener='x';
  StringBuilder out=new StringBuilder();
  for (int i=0; i < jsonString.length(); i++) {
    char c=jsonString.charAt(i);
    String cc=jsonString.substring(i,Math.min(i + 2,jsonString.length()));
    if (in_string) {
      if (c == string_opener) {
        in_string=false;
        out.append(c);
      }
 else       if (c == '\\') {
        out.append(cc);
        ++i;
      }
 else {
        out.append(c);
      }
    }
 else     if (in_singleline_comment) {
      if (c == '\r' || c == '\n') {
        in_singleline_comment=false;
      }
    }
 else     if (in_multiline_comment) {
      if (cc.equals("String_Node_Str")) {
        in_multiline_comment=false;
        ++i;
      }
    }
 else     if (cc.equals("String_Node_Str")) {
      in_multiline_comment=true;
      ++i;
    }
 else     if (cc.equals("String_Node_Str")) {
      in_singleline_comment=true;
      ++i;
    }
 else     if (c == '"' || c == '\'') {
      in_string=true;
      string_opener=c;
      out.append(c);
    }
 else     if (!Character.isWhitespace(c)) {
      out.append(c);
    }
  }
  return out.toString();
}
Program: 93454
Project: 93454
Buggy source:
public BsonDocument getSortByDocument() throws JsonParseException {
  BsonDocument sort=new BsonDocument();
  if (sortBy == null || sortBy.isEmpty()) {
    sort.put("String_Node_Str",new BsonInt32(-1));
  }
 else {
    sortBy.stream().forEach((s) -> {
      String _s=s.trim();
      try {
        BsonDocument _sort=BsonDocument.parse(_s);
        sort.putAll(_sort);
      }
 catch (      JsonParseException e) {
        if (_s.startsWith("String_Node_Str")) {
          sort.put(_s.substring(1),new BsonInt32(-1));
        }
 else         if (_s.startsWith("String_Node_Str")) {
          sort.put(_s.substring(1),new BsonInt32(11));
        }
 else {
          sort.put(_s,new BsonInt32(1));
        }
      }
    }
);
  }
  return sort;
}

Fixed version (ground truth):
public BsonDocument getSortByDocument() throws JsonParseException {
  BsonDocument sort=new BsonDocument();
  if (sortBy == null) {
    sort.put("String_Node_Str",new BsonInt32(-1));
  }
 else {
    sortBy.stream().forEach((s) -> {
      String _s=s.trim();
      try {
        BsonDocument _sort=BsonDocument.parse(_s);
        sort.putAll(_sort);
      }
 catch (      JsonParseException e) {
        if (_s.startsWith("String_Node_Str")) {
          sort.put(_s.substring(1),new BsonInt32(-1));
        }
 else         if (_s.startsWith("String_Node_Str")) {
          sort.put(_s.substring(1),new BsonInt32(11));
        }
 else {
          sort.put(_s,new BsonInt32(1));
        }
      }
    }
);
  }
  return sort;
}
Program: 93456
Project: 93456
Buggy source:
@Override public void transform(HttpServerExchange exchange,RequestContext context,BsonValue contentToTransform,BsonValue args){
  if (context.getDbOperationResult() == null) {
    return;
  }
 else {
    BsonDocument resp=null;
    if (contentToTransform == null || !contentToTransform.isDocument()) {
      resp=new BsonDocument();
      context.setResponseContent(resp);
    }
 else     if (contentToTransform.isDocument()) {
      resp=contentToTransform.asDocument();
    }
    if (resp != null) {
      resp.append("String_Node_Str",context.getDbOperationResult().getOldData() == null ? new BsonNull() : context.getDbOperationResult().getOldData());
      resp.append("String_Node_Str",context.getDbOperationResult().getNewData());
    }
  }
}

Fixed version (ground truth):
@Override public void transform(HttpServerExchange exchange,RequestContext context,BsonValue contentToTransform,BsonValue args){
  if (context.getDbOperationResult() == null) {
    return;
  }
 else {
    BsonDocument resp=null;
    if (contentToTransform == null || !contentToTransform.isDocument()) {
      resp=new BsonDocument();
      context.setResponseContent(resp);
    }
 else     if (contentToTransform.isDocument()) {
      resp=contentToTransform.asDocument();
    }
    if (resp != null) {
      resp.append("String_Node_Str",context.getDbOperationResult().getOldData() == null ? new BsonNull() : context.getDbOperationResult().getOldData());
      resp.append("String_Node_Str",context.getDbOperationResult().getNewData() == null ? new BsonNull() : context.getDbOperationResult().getNewData());
    }
  }
}
Program: 93460
Project: 93460
Buggy source:
@Override public boolean check(HttpServerExchange exchange,RequestContext context,BasicDBObject contentToCheck,DBObject args){
  if (args instanceof BasicDBList) {
    BasicDBList conditions=filterMissingOptionalAndNullNullableConditions((BasicDBList)args,context.getContent());
    return applyConditions(conditions,contentToCheck,context);
  }
 else {
    context.addWarning("String_Node_Str");
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean check(HttpServerExchange exchange,RequestContext context,BasicDBObject contentToCheck,DBObject args){
  if (args instanceof BasicDBList) {
    BasicDBList conditions=filterMissingOptionalAndNullNullableConditions((BasicDBList)args,contentToCheck);
    return applyConditions(conditions,contentToCheck,context);
  }
 else {
    context.addWarning("String_Node_Str");
    return true;
  }
}
Program: 93461
Project: 93461
Buggy source:
/** 
 * see bug https://softinstigate.atlassian.net/browse/RH-160 the bug is won't fix because checker is deprecated
 * @throws Exception 
 */
@Test public void testPatchIncompleteObject() throws Exception {
  Response resp;
  final String VALID_USER=getResourceFile("String_Node_Str");
  resp=adminExecutor.execute(Request.Post(collectionTmpUri).bodyString(VALID_USER,halCT).addHeader(Headers.CONTENT_TYPE_STRING,Representation.HAL_JSON_MEDIA_TYPE));
  check("String_Node_Str",resp,HttpStatus.SC_CREATED);
  final String INCOMPLETE_OBJ="String_Node_Str";
  resp=adminExecutor.execute(Request.Patch(userURI).bodyString(INCOMPLETE_OBJ,halCT).addHeader(Headers.CONTENT_TYPE_STRING,Representation.HAL_JSON_MEDIA_TYPE));
  check("String_Node_Str",resp,HttpStatus.SC_BAD_REQUEST);
}

Fixed version (ground truth):
/** 
 * see bug https://softinstigate.atlassian.net/browse/RH-160
 * @throws Exception 
 */
@Test public void testPatchIncompleteObject() throws Exception {
  Response resp;
  final String VALID_USER=getResourceFile("String_Node_Str");
  resp=adminExecutor.execute(Request.Post(collectionTmpUri).bodyString(VALID_USER,halCT).addHeader(Headers.CONTENT_TYPE_STRING,Representation.HAL_JSON_MEDIA_TYPE));
  check("String_Node_Str",resp,HttpStatus.SC_CREATED);
  final String INCOMPLETE_OBJ="String_Node_Str";
  resp=adminExecutor.execute(Request.Patch(userURI).bodyString(INCOMPLETE_OBJ,halCT).addHeader(Headers.CONTENT_TYPE_STRING,Representation.HAL_JSON_MEDIA_TYPE));
  check("String_Node_Str",resp,HttpStatus.SC_BAD_REQUEST);
}
Program: 93463
Project: 93463
Buggy source:
private void embeddedDocuments(List<DBObject> embeddedData,String requestPath,HttpServerExchange exchange,RequestContext context,Representation rep) throws IllegalQueryParamenterException {
  for (  DBObject d : embeddedData) {
    Object _id=d.get("String_Node_Str");
    if (RequestContext.isReservedResourceCollection(_id.toString())) {
      rep.addWarning("String_Node_Str" + requestPath + "String_Node_Str"+ _id.toString());
    }
 else {
      Representation nrep=new DocumentRepresentationFactory().getRepresentation(requestPath + "String_Node_Str" + _id.toString(),exchange,context,d);
      if (context.getType() == RequestContext.TYPE.FILES_BUCKET) {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.FILE,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
 else       if (context.getType() == RequestContext.TYPE.SCHEMA_STORE) {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.SCHEMA,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
 else {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.DOCUMENT,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
    }
  }
}

Fixed version (ground truth):
private void embeddedDocuments(List<DBObject> embeddedData,String requestPath,HttpServerExchange exchange,RequestContext context,Representation rep) throws IllegalQueryParamenterException {
  for (  DBObject d : embeddedData) {
    Object _id=d.get("String_Node_Str");
    if (_id != null && RequestContext.isReservedResourceCollection(_id.toString())) {
      rep.addWarning("String_Node_Str" + requestPath + "String_Node_Str"+ _id.toString());
    }
 else {
      Representation nrep;
      if (_id == null) {
        nrep=new DocumentRepresentationFactory().getRepresentation(requestPath + "String_Node_Str",exchange,context,d);
      }
 else {
        nrep=new DocumentRepresentationFactory().getRepresentation(requestPath + "String_Node_Str" + _id.toString(),exchange,context,d);
      }
      if (context.getType() == RequestContext.TYPE.FILES_BUCKET) {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.FILE,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
 else       if (context.getType() == RequestContext.TYPE.SCHEMA_STORE) {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.SCHEMA,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
 else {
        if (context.isFullHalMode()) {
          DocumentRepresentationFactory.addSpecialProperties(nrep,TYPE.DOCUMENT,d);
        }
        rep.addRepresentation("String_Node_Str",nrep);
      }
    }
  }
}
Program: 93464
Project: 93464
Buggy source:
public static Object getId(String id,DOC_ID_TYPE type) throws UnsupportedDocumentIdException {
  if (id == null) {
    return null;
  }
  if (type == null) {
    type=DOC_ID_TYPE.STRING_OID;
  }
  if (RequestContext.MAX_KEY_ID.equalsIgnoreCase(id)) {
    return new MaxKey();
  }
  if (RequestContext.MIN_KEY_ID.equalsIgnoreCase(id)) {
    return new MinKey();
  }
  try {
switch (type) {
case STRING_OID:
      return getIdAsStringOrObjectId(id);
case OID:
    return getIdAsObjectId(id);
case STRING:
  return id;
case NUMBER:
return getIdAsNumber(id);
case MINKEY:
return new MinKey();
case MAXKEY:
return new MaxKey();
case DATE:
return getIdAsDate(id);
}
}
 catch (IllegalArgumentException iar) {
throw new UnsupportedDocumentIdException(iar);
}
return id;
}

Fixed version (ground truth):
public static Object getId(String id,DOC_ID_TYPE type) throws UnsupportedDocumentIdException {
  if (id == null) {
    return null;
  }
  if (type == null) {
    type=DOC_ID_TYPE.STRING_OID;
  }
  if (RequestContext.MAX_KEY_ID.equalsIgnoreCase(id)) {
    return new MaxKey();
  }
  if (RequestContext.MIN_KEY_ID.equalsIgnoreCase(id)) {
    return new MinKey();
  }
  if (RequestContext.NULL_KEY_ID.equalsIgnoreCase(id)) {
    return null;
  }
  try {
switch (type) {
case STRING_OID:
      return getIdAsStringOrObjectId(id);
case OID:
    return getIdAsObjectId(id);
case STRING:
  return id;
case NUMBER:
return getIdAsNumber(id);
case MINKEY:
return new MinKey();
case MAXKEY:
return new MaxKey();
case DATE:
return getIdAsDate(id);
}
}
 catch (IllegalArgumentException iar) {
throw new UnsupportedDocumentIdException(iar);
}
return id;
}
Program: 93466
Project: 93466
Buggy source:
/** 
 * @param type
 * @param documentIdRaw
 * @return true if the documentIdRaw is a reserved resource
 */
public static boolean isReservedResourceDocument(TYPE type,String documentIdRaw){
  if (documentIdRaw == null) {
    return false;
  }
  return (documentIdRaw.startsWith(UNDERSCORE) || (type != TYPE.AGGREGATION && _AGGREGATIONS.equalsIgnoreCase(documentIdRaw))) && !documentIdRaw.equalsIgnoreCase(_INDEXES) && !documentIdRaw.equalsIgnoreCase(MIN_KEY_ID)&& !documentIdRaw.equalsIgnoreCase(MAX_KEY_ID)&& !(type == TYPE.AGGREGATION) || (documentIdRaw.equals(RESOURCES_WILDCARD_KEY) && !(type == TYPE.BULK_DOCUMENTS));
}

Fixed version (ground truth):
/** 
 * @param type
 * @param documentIdRaw
 * @return true if the documentIdRaw is a reserved resource
 */
public static boolean isReservedResourceDocument(TYPE type,String documentIdRaw){
  if (documentIdRaw == null) {
    return false;
  }
  return (documentIdRaw.startsWith(UNDERSCORE) || (type != TYPE.AGGREGATION && _AGGREGATIONS.equalsIgnoreCase(documentIdRaw))) && !documentIdRaw.equalsIgnoreCase(_INDEXES) && !documentIdRaw.equalsIgnoreCase(MIN_KEY_ID)&& !documentIdRaw.equalsIgnoreCase(MAX_KEY_ID)&& !documentIdRaw.equalsIgnoreCase(NULL_KEY_ID)&& !(type == TYPE.AGGREGATION) || (documentIdRaw.equals(RESOURCES_WILDCARD_KEY) && !(type == TYPE.BULK_DOCUMENTS));
}
Program: 93467
Project: 93467
Buggy source:
/** 
 * @param dbName
 * @return
 */
@Override public boolean doesDbExist(String dbName){
  if (dbName == null || dbName.isEmpty() || dbName.contains("String_Node_Str")) {
    return false;
  }
  return client.getDatabase(dbName).listCollectionNames().first() != null;
}

Fixed version (ground truth):
/** 
 * @param dbName
 * @return
 */
@Override public boolean doesDbExist(String dbName){
  return client.getDatabase(dbName).listCollectionNames().first() != null;
}
Program: 93468
Project: 93468
Buggy source:
/** 
 * @param dbName
 * @param collName
 * @return
 */
List<DBObject> getCollectionIndexes(String dbName,String collName){
  List<DBObject> indexes=client.getDB(dbName).getCollection("String_Node_Str").find(new BasicDBObject("String_Node_Str",dbName + "String_Node_Str" + collName),FIELDS_TO_RETURN_INDEXES).sort(new BasicDBObject("String_Node_Str",1)).toArray();
  indexes.forEach((i) -> {
    i.put("String_Node_Str",i.get("String_Node_Str"));
    i.removeField("String_Node_Str");
  }
);
  return indexes;
}

Fixed version (ground truth):
/** 
 * @param dbName
 * @param collName
 * @return
 */
List<DBObject> getCollectionIndexes(String dbName,String collName){
  List<DBObject> indexes=client.getDB(dbName).getCollection(collName).getIndexInfo();
  indexes.forEach(i -> {
    i.put("String_Node_Str",i.get("String_Node_Str"));
    i.removeField("String_Node_Str");
  }
);
  return indexes;
}
Program: 93470
Project: 93470
Buggy source:
/** 
 * @param exchange the url rewriting feature is implemented by the whatUriand whereUri parameters the exchange request path is rewritten replacing the whereUri string with the whatUri string the special whatUri value * means any resource: the whereUri is replaced with / example 1 whatUri = /mydb/mycollection whereUri = / then the requestPath / is rewritten to /mydb/mycollection example 2 whatUri = * whereUri = /data then the requestPath /data is rewritten to /
 * @param whereUri the uri to map to
 * @param whatUri the uri to map
 */
public RequestContext(HttpServerExchange exchange,String whereUri,String whatUri){
  this.whereUri=URLUtils.removeTrailingSlashes(whereUri == null ? null : whereUri.startsWith("String_Node_Str") ? whereUri : "String_Node_Str" + whereUri);
  this.whatUri=URLUtils.removeTrailingSlashes(whatUri == null ? null : whatUri.startsWith("String_Node_Str") ? whatUri : "String_Node_Str" + whatUri);
  this.unmappedRequestUri=exchange.getRequestPath();
  this.mappedRequestUri=unmapUri(exchange.getRequestPath());
  this.pathTokens=this.mappedRequestUri.split(SLASH);
  this.type=selectRequestType(pathTokens);
  this.method=selectRequestMethod(exchange.getRequestMethod());
}

Fixed version (ground truth):
/** 
 * @param exchange the url rewriting feature is implemented by the whatUriand whereUri parameters the exchange request path is rewritten replacing the whereUri string with the whatUri string the special whatUri value * means any resource: the whereUri is replaced with / example 1 whatUri = /mydb/mycollection whereUri = / then the requestPath / is rewritten to /mydb/mycollection example 2 whatUri = * whereUri = /data then the requestPath /data is rewritten to /
 * @param whereUri the uri to map to
 * @param whatUri the uri to map
 */
public RequestContext(HttpServerExchange exchange,String whereUri,String whatUri){
  this.whereUri=URLUtils.removeTrailingSlashes(whereUri == null ? null : whereUri.startsWith("String_Node_Str") ? whereUri : "String_Node_Str" + whereUri);
  this.whatUri=URLUtils.removeTrailingSlashes(whatUri == null ? null : whatUri.startsWith("String_Node_Str") || "String_Node_Str".equals(whatUri) ? whatUri : "String_Node_Str" + whatUri);
  this.unmappedRequestUri=exchange.getRequestPath();
  this.mappedRequestUri=unmapUri(exchange.getRequestPath());
  this.pathTokens=this.mappedRequestUri.split(SLASH);
  this.type=selectRequestType(pathTokens);
  this.method=selectRequestMethod(exchange.getRequestMethod());
}
Program: 93471
Project: 93471
Buggy source:
/** 
 * WARNING: slow method.
 * @param dbName
 * @return
 */
@Override public boolean doesDbExist(String dbName){
  if (dbName == null || dbName.isEmpty() || dbName.contains("String_Node_Str")) {
    return false;
  }
  CommandResult res=client.getDB(dbName).command("String_Node_Str");
  return (res.get("String_Node_Str") != null && res.get("String_Node_Str") instanceof BasicDBObject && ((BasicDBObject)res.get("String_Node_Str")).get("String_Node_Str") != null && ((BasicDBObject)res.get("String_Node_Str")).get("String_Node_Str") instanceof BasicDBList && ((BasicDBList)((BasicDBObject)res.get("String_Node_Str")).get("String_Node_Str")).size() > 0);
}

Fixed version (ground truth):
/** 
 * @param dbName
 * @return
 */
@Override public boolean doesDbExist(String dbName){
  if (dbName == null || dbName.isEmpty() || dbName.contains("String_Node_Str")) {
    return false;
  }
  return client.getDB(dbName).collectionExists("String_Node_Str");
}
Program: 93472
Project: 93472
Buggy source:
protected void addReturnedProperty(final List<DBObject> embeddedData,final Representation rep){
  long count=embeddedData == null ? 0 : embeddedData.stream().filter((props) -> props.keySet().stream().anyMatch((k) -> k.equals("String_Node_Str") || k.equals("String_Node_Str"))).count();
  rep.addProperty("String_Node_Str",count);
}

Fixed version (ground truth):
protected void addReturnedProperty(final List<DBObject> embeddedData,final Representation rep){
  long count=embeddedData == null ? 0 : embeddedData.stream().filter((props) -> props != null && props.keySet().stream().anyMatch((k) -> k.equals("String_Node_Str") || k.equals("String_Node_Str"))).count();
  rep.addProperty("String_Node_Str",count);
}