nus-yam/ex-repair huggingface dataset:
Program: 56266
Project: 56266
Buggy source:
/** 
 * Main method. accepts a single parameter, which is the config directory.
 * @param args The parameters to the entry point.
 */
public static void main(String[] args){
  try {
    String configDir=null;
    if (args.length >= 2 && args[0].equals("String_Node_Str")) {
      configDir=args[1];
    }
    if (configDir == null) {
      System.err.println("String_Node_Str");
      System.exit(1);
      return;
    }
    GlobalConfiguration.loadConfiguration(configDir);
    Configuration config=GlobalConfiguration.getConfiguration();
    int port=config.getInteger(PactConfigConstants.WEB_FRONTEND_PORT_KEY,PactConfigConstants.DEFAULT_WEB_FRONTEND_PORT);
    WebInterfaceServer server=new WebInterfaceServer(config,port);
    LOG.info("String_Node_Str" + port + '.');
    server.start();
    server.join();
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str" + t.getMessage(),t);
  }
}

Fixed version (ground truth):
/** 
 * Main method. accepts a single parameter, which is the config directory.
 * @param args The parameters to the entry point.
 */
public static void main(String[] args){
  try {
    String configDir=null;
    if (args.length >= 2 && args[0].equals("String_Node_Str")) {
      configDir=args[1];
    }
    if (configDir == null) {
      System.err.println("String_Node_Str");
      System.exit(1);
      return;
    }
    GlobalConfiguration.loadConfiguration(configDir);
    Configuration config=GlobalConfiguration.getConfiguration();
    config.setString(PactConfigConstants.STRATOSPHERE_BASE_DIR_PATH_KEY,configDir + "String_Node_Str");
    int port=config.getInteger(PactConfigConstants.WEB_FRONTEND_PORT_KEY,PactConfigConstants.DEFAULT_WEB_FRONTEND_PORT);
    WebInterfaceServer server=new WebInterfaceServer(config,port);
    LOG.info("String_Node_Str" + port + '.');
    server.start();
    server.join();
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str" + t.getMessage(),t);
  }
}
Program: 56269
Project: 56269
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public InstanceType getDefaultInstanceType(){
  return this.availableInstanceTypes[this.defaultInstanceTypeIndex - 1];
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public InstanceType getDefaultInstanceType(){
  return this.availableInstanceTypes[this.defaultInstanceTypeIndex];
}
Program: 56270
Project: 56270
Buggy source:
/** 
 * Constructor.
 */
public ClusterManager(){
  this.availableInstanceTypes=populateInstanceTypeArray();
  long tmpCleanUpInterval=(long)GlobalConfiguration.getInteger(CLEANUP_INTERVAL_KEY,DEFAULT_CLEANUP_INTERVAL) * 1000;
  if ((tmpCleanUpInterval % BASE_INTERVAL) != 0) {
    LOG.warn("String_Node_Str" + DEFAULT_CLEANUP_INTERVAL);
    tmpCleanUpInterval=DEFAULT_CLEANUP_INTERVAL;
  }
  this.cleanUpInterval=tmpCleanUpInterval;
  int tmpDefaultInstanceTypeIndex=GlobalConfiguration.getInteger(DEFAULT_INSTANCE_TYPE_INDEX_KEY,DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX);
  if (tmpDefaultInstanceTypeIndex >= this.availableInstanceTypes.length) {
    LOG.warn("String_Node_Str" + DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX);
    tmpDefaultInstanceTypeIndex=DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX;
  }
  this.defaultInstanceTypeIndex=tmpDefaultInstanceTypeIndex;
  this.networkTopology=loadNetworkTopology();
  loadIPToInstanceTypeMapping();
  final boolean runTimerAsDaemon=true;
  new Timer(runTimerAsDaemon).schedule(cleanupStaleMachines,BASE_INTERVAL,BASE_INTERVAL);
}

Fixed version (ground truth):
/** 
 * Constructor.
 */
public ClusterManager(){
  this.availableInstanceTypes=populateInstanceTypeArray(LOG);
  long tmpCleanUpInterval=(long)GlobalConfiguration.getInteger(ConfigConstants.INSTANCE_MANAGER_CLEANUP_INTERVAL_KEY,DEFAULT_CLEANUP_INTERVAL) * 1000;
  if ((tmpCleanUpInterval % BASE_INTERVAL) != 0) {
    LOG.warn("String_Node_Str" + DEFAULT_CLEANUP_INTERVAL + "String_Node_Str");
    tmpCleanUpInterval=DEFAULT_CLEANUP_INTERVAL;
  }
  this.cleanUpInterval=tmpCleanUpInterval;
  int tmpDefaultInstanceTypeIndex=GlobalConfiguration.getInteger(ConfigConstants.INSTANCE_MANAGER_DEFAULT_INSTANCE_TYPE_INDEX_KEY,ConfigConstants.DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX);
  if (tmpDefaultInstanceTypeIndex > this.availableInstanceTypes.length) {
    LOG.warn("String_Node_Str" + tmpDefaultInstanceTypeIndex + "String_Node_Str"+ ConfigConstants.DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX);
    tmpDefaultInstanceTypeIndex=ConfigConstants.DEFAULT_DEFAULT_INSTANCE_TYPE_INDEX;
  }
  this.defaultInstanceTypeIndex=tmpDefaultInstanceTypeIndex - 1;
  this.networkTopology=loadNetworkTopology();
  loadIPToInstanceTypeMapping();
  final boolean runTimerAsDaemon=true;
  new Timer(runTimerAsDaemon).schedule(cleanupStaleMachines,BASE_INTERVAL,BASE_INTERVAL);
}
Program: 56271
Project: 56271
Buggy source:
protected static String scanAfterClosedParenthesis(String currentToken,Scanner scanner){
  int countParenthesisOpen=countChar(currentToken,'(');
  int countParenthesisClose=countChar(currentToken,')');
  if (countParenthesisOpen == countParenthesisClose) {
    return scanner.next();
  }
  Deque<Integer> stack=new ArrayDeque<>();
  for (int iCount=0; iCount < countParenthesisOpen - countParenthesisClose; iCount++) {
    stack.push(1);
  }
  String token=scanner.next();
  whilestack:   do {
    for (    Examiner examiner : JavaSourceInspector.getInstance().getExaminers()) {
      if (examiner.getTypeFromToken(token) != null) {
        break whilestack;
      }
    }
    if (token.indexOf('(') > -1) {
      int countOpenParenthesis=countChar(token,'(');
      for (int iCount=0; iCount < countOpenParenthesis; iCount++) {
        stack.push(1);
      }
    }
    if (token.indexOf(')') > -1) {
      int countClosedParenthesis=countChar(token,')');
      for (int iCount=0; iCount < countClosedParenthesis; iCount++) {
        stack.pop();
      }
    }
    if (scanner.hasNext()) {
      token=scanner.next();
    }
 else {
      break;
    }
  }
 while (stack.size() > 0);
  return token;
}

Fixed version (ground truth):
protected static String scanAfterClosedParenthesis(String currentToken,Scanner scanner){
  int countParenthesisOpen=countChar(currentToken,'(');
  int countParenthesisClose=countChar(currentToken,')');
  if (countParenthesisOpen == countParenthesisClose) {
    return scanner.next();
  }
  Deque<Integer> stack=new ArrayDeque<>();
  for (int iCount=0; iCount < countParenthesisOpen - countParenthesisClose; iCount++) {
    stack.push(1);
  }
  if (!scanner.hasNext()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String token=scanner.next();
  whilestack:   do {
    for (    Examiner examiner : JavaSourceInspector.getInstance().getExaminers()) {
      if (examiner.getTypeFromToken(token) != null) {
        break whilestack;
      }
    }
    if (token.indexOf('(') > -1) {
      int countOpenParenthesis=countChar(token,'(');
      for (int iCount=0; iCount < countOpenParenthesis; iCount++) {
        stack.push(1);
      }
    }
    if (token.indexOf(')') > -1) {
      int countClosedParenthesis=countChar(token,')');
      for (int iCount=0; iCount < countClosedParenthesis; iCount++) {
        stack.pop();
      }
    }
    if (scanner.hasNext()) {
      token=scanner.next();
    }
 else {
      break;
    }
  }
 while (stack.size() > 0);
  return token;
}
Program: 56272
Project: 56272
Buggy source:
protected static void findAndSetPackage(JavaSource javaSource){
  Scanner scanner=Examiner.getSourceCodeScanner(javaSource.getSourceCode());
  while (scanner.hasNext()) {
    String token=scanner.next();
    if (javaSource.getPackagePath() == null && token.equals("String_Node_Str")) {
      token=scanner.next();
      if (token.endsWith("String_Node_Str")) {
        String packagePath=token.substring(0,token.indexOf(';'));
        javaSource.setPackagePath(packagePath);
      }
    }
  }
}

Fixed version (ground truth):
protected static void findAndSetPackage(JavaSource javaSource){
  Scanner scanner=Examiner.getSourceCodeScanner(javaSource.getSourceCode());
  while (scanner.hasNext()) {
    String token=scanner.next();
    if (javaSource.getPackagePath() == null && token.equals("String_Node_Str")) {
      if (!scanner.hasNext()) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      token=scanner.next();
      if (token.endsWith("String_Node_Str")) {
        String packagePath=token.substring(0,token.indexOf(';'));
        javaSource.setPackagePath(packagePath);
      }
    }
  }
}
Program: 56273
Project: 56273
Buggy source:
protected static String jumpOverJavaToken(String token,Scanner scanner){
  String nextToken=token;
  while (isAJavaToken(nextToken)) {
    if (nextToken.startsWith("String_Node_Str") && nextToken.indexOf('(') > -1 && !nextToken.endsWith("String_Node_Str")) {
      nextToken=scanAfterClosedParenthesis(nextToken,scanner);
    }
 else {
      nextToken=scanner.next();
    }
  }
  return nextToken;
}

Fixed version (ground truth):
protected static String jumpOverJavaToken(String token,Scanner scanner){
  String nextToken=token;
  while (isAJavaToken(nextToken)) {
    if (!scanner.hasNext()) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    if (nextToken.startsWith("String_Node_Str") && nextToken.indexOf('(') > -1 && !nextToken.endsWith("String_Node_Str")) {
      nextToken=scanAfterClosedParenthesis(nextToken,scanner);
    }
 else {
      nextToken=scanner.next();
    }
  }
  return nextToken;
}
Program: 56274
Project: 56274
Buggy source:
public void request(final String method,final String url,final Map<String,Object> headers,final List<Object> json,final Closure<Response> handler){
  request(method,url,toMultiMap(headers),new Buffer(new JsonArray(json).encode()),new Handler<Response>(){
    @Override public void handle(    Response event){
      handler.call(event);
    }
  }
);
}

Fixed version (ground truth):
public void request(final String method,final String url,final Map<String,Object> headers,final List<Object> json,final Closure<Response> handler){
  request(method,url,toMultiMap(headers),new org.vertx.java.core.buffer.Buffer(new JsonArray(json).encode()),new Handler<Response>(){
    @Override public void handle(    Response event){
      handler.call(event);
    }
  }
);
}
Program: 56275
Project: 56275
Buggy source:
/** 
 * Write a file into the response body
 * @param request
 * @param file
 * @param props
 */
private void sendFile(final YokeRequest request,final String file,final FileProps props){
  String contentType=MimeType.getMime(file);
  String charset=MimeType.getCharset(contentType);
  request.response().setContentType(contentType,charset);
  request.response().putHeader("String_Node_Str",Long.toString(props.size()));
  if ("String_Node_Str".equals(request.method())) {
    request.response().end();
  }
 else {
    request.response().sendFile(file);
    request.response().end();
  }
}

Fixed version (ground truth):
/** 
 * Write a file into the response body
 * @param request
 * @param file
 * @param props
 */
private void sendFile(final YokeRequest request,final String file,final FileProps props){
  String contentType=MimeType.getMime(file);
  String charset=MimeType.getCharset(contentType);
  request.response().setContentType(contentType,charset);
  request.response().putHeader("String_Node_Str",Long.toString(props.size()));
  if ("String_Node_Str".equals(request.method())) {
    request.response().end();
  }
 else {
    request.response().sendFile(file);
  }
}
Program: 56276
Project: 56276
Buggy source:
@Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
}

Fixed version (ground truth):
@Override public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
  throw new MBeanException(new UnsupportedOperationException());
}
Program: 56277
Project: 56277
Buggy source:
@Override public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
  return null;
}

Fixed version (ground truth):
@Override public synchronized Object getAttribute(String name) throws AttributeNotFoundException {
  Matcher m=middlewarePattern.matcher(name);
  if (m.matches()) {
    return middleware.get(Integer.parseInt(m.group(1))).getClass().getName();
  }
  throw new AttributeNotFoundException("String_Node_Str" + name);
}
Program: 56278
Project: 56278
Buggy source:
@Override public AttributeList getAttributes(String[] attributes){
  return null;
}

Fixed version (ground truth):
private MBeanAttributeInfo[] getAttributes(){
  MBeanAttributeInfo[] attrs=new MBeanAttributeInfo[middleware.size()];
  for (int i=0; i < middleware.size(); i++) {
    attrs[i]=new MBeanAttributeInfo("String_Node_Str" + i + "String_Node_Str","String_Node_Str","String_Node_Str" + i,true,false,false);
  }
  return attrs;
}
Program: 56279
Project: 56279
Buggy source:
@Override public Object invoke(String actionName,Object[] params,String[] signature) throws MBeanException, ReflectionException {
  return null;
}

Fixed version (ground truth):
@Override public Object invoke(String actionName,Object[] params,String[] signature) throws MBeanException, ReflectionException {
  throw new MBeanException(new UnsupportedOperationException());
}
Program: 56280
Project: 56280
Buggy source:
@Override public AttributeList setAttributes(AttributeList attributes){
  return null;
}

Fixed version (ground truth):
@Override public AttributeList setAttributes(AttributeList attributes){
  return new AttributeList();
}
Program: 56281
Project: 56281
Buggy source:
@Override public MBeanInfo getMBeanInfo(){
  return new MBeanInfo(this.getClass().getName(),"String_Node_Str",null,null,null,null);
}

Fixed version (ground truth):
@Override public MBeanInfo getMBeanInfo(){
  return new MBeanInfo(this.getClass().getName(),"String_Node_Str",getAttributes(),null,null,null);
}
Program: 56282
Project: 56282
Buggy source:
void addMiddleware(@NotNull Middleware[] middleware){
  Collections.addAll(this.middleware,middleware);
}

Fixed version (ground truth):
private void addMiddleware(@NotNull Middleware[] middleware){
  Collections.addAll(this.middleware,middleware);
  try {
    mbs.unregisterMBean(objectName);
  }
 catch (  InstanceNotFoundException e) {
  }
catch (  MBeanRegistrationException e) {
    throw new RuntimeException(e);
  }
  try {
    mbs.registerMBean(new RouteMBean(this.middleware),objectName);
  }
 catch (  InstanceAlreadyExistsException e) {
  }
catch (  MBeanRegistrationException|NotCompliantMBeanException e) {
    throw new RuntimeException(e);
  }
}
Program: 56283
Project: 56283
Buggy source:
private void addPattern(String verb,String input,Middleware[] handler,List<PatternBinding> bindings){
  Matcher m=Pattern.compile("String_Node_Str").matcher(input);
  StringBuffer sb=new StringBuffer();
  Set<String> groups=new HashSet<>();
  while (m.find()) {
    String group=m.group().substring(1);
    if (groups.contains(group)) {
      throw new IllegalArgumentException("String_Node_Str" + group + "String_Node_Str");
    }
    m.appendReplacement(sb,"String_Node_Str");
    groups.add(group);
  }
  m.appendTail(sb);
  if (sb.charAt(sb.length() - 1) != '/') {
    sb.append("String_Node_Str");
  }
  Pattern regex=Pattern.compile(sb.toString());
  boolean exists=false;
  for (  PatternBinding pb : bindings) {
    if (pb.pattern.equals(regex)) {
      pb.addMiddleware(handler);
      exists=true;
      break;
    }
  }
  if (!exists) {
    PatternBinding binding=new PatternBinding(hashCode(),verb,input,regex,groups,handler);
    bindings.add(binding);
  }
  for (  Middleware h : handler) {
    if (!h.isInitialized() && isInitialized()) {
      h.init(yoke,mount);
    }
  }
}

Fixed version (ground truth):
private void addPattern(String verb,String input,Middleware[] handler,List<PatternBinding> bindings){
  Matcher m=Pattern.compile("String_Node_Str").matcher(input);
  StringBuffer sb=new StringBuffer();
  Set<String> groups=new HashSet<>();
  while (m.find()) {
    String group=m.group().substring(1);
    if (groups.contains(group)) {
      throw new IllegalArgumentException("String_Node_Str" + group + "String_Node_Str");
    }
    m.appendReplacement(sb,"String_Node_Str");
    groups.add(group);
  }
  m.appendTail(sb);
  if (sb.charAt(sb.length() - 1) != '/') {
    sb.append("String_Node_Str");
  }
  Pattern regex=Pattern.compile(sb.toString());
  boolean exists=false;
  for (  PatternBinding pb : bindings) {
    if (pb.isFor(input)) {
      exists=true;
      pb.addMiddleware(handler);
      break;
    }
  }
  if (!exists) {
    PatternBinding binding=new PatternBinding(hashCode(),verb,input,regex,groups,handler);
    bindings.add(binding);
  }
  for (  Middleware h : handler) {
    if (!h.isInitialized() && isInitialized()) {
      h.init(yoke,mount);
    }
  }
}
Program: 56284
Project: 56284
Buggy source:
private PatternBinding(int hasCode,@NotNull String verb,@Nullable String route,@NotNull Pattern pattern,Set<String> paramNames,@NotNull Middleware[] middleware){
  this.pattern=pattern;
  this.paramNames=paramNames;
  Collections.addAll(this.middleware,middleware);
  final MBeanServer mbs=ManagementFactory.getPlatformMBeanServer();
  try {
    mbs.registerMBean(new RouteMBean(),new ObjectName("String_Node_Str" + hasCode + "String_Node_Str"+ verb+ "String_Node_Str"+ ObjectName.quote(route)));
  }
 catch (  InstanceAlreadyExistsException e) {
  }
catch (  MalformedObjectNameException|MBeanRegistrationException|NotCompliantMBeanException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private PatternBinding(int hasCode,@NotNull String verb,@Nullable String route,@NotNull Pattern pattern,@Nullable Set<String> paramNames,@NotNull Middleware[] middleware){
  this.route=route;
  this.pattern=pattern;
  this.paramNames=paramNames;
  Collections.addAll(this.middleware,middleware);
  try {
    objectName=new ObjectName("String_Node_Str" + hasCode + "String_Node_Str"+ verb+ "String_Node_Str"+ ObjectName.quote(route));
  }
 catch (  MalformedObjectNameException e) {
    throw new RuntimeException(e);
  }
  try {
    mbs.registerMBean(new RouteMBean(this.middleware),objectName);
  }
 catch (  InstanceAlreadyExistsException e) {
  }
catch (  MBeanRegistrationException|NotCompliantMBeanException e) {
    throw new RuntimeException(e);
  }
}
Program: 56285
Project: 56285
Buggy source:
private void addRegEx(String verb,Pattern regex,Middleware handler[],List<PatternBinding> bindings){
  boolean exists=false;
  for (  PatternBinding pb : bindings) {
    if (pb.pattern.equals(regex)) {
      pb.addMiddleware(handler);
      exists=true;
      break;
    }
  }
  if (!exists) {
    PatternBinding binding=new PatternBinding(hashCode(),verb,regex.pattern(),regex,null,handler);
    bindings.add(binding);
  }
  for (  Middleware h : handler) {
    if (!h.isInitialized() && isInitialized()) {
      h.init(yoke,mount);
    }
  }
}

Fixed version (ground truth):
private void addRegEx(String verb,Pattern regex,Middleware handler[],List<PatternBinding> bindings){
  boolean exists=false;
  for (  PatternBinding pb : bindings) {
    if (pb.isFor(regex)) {
      pb.addMiddleware(handler);
      exists=true;
      break;
    }
  }
  if (!exists) {
    PatternBinding binding=new PatternBinding(hashCode(),verb,null,regex,null,handler);
    bindings.add(binding);
  }
  for (  Middleware h : handler) {
    if (!h.isInitialized() && isInitialized()) {
      h.init(yoke,mount);
    }
  }
}
Program: 56287
Project: 56287
Buggy source:
public String encode(JsonObject payload,String algorithm){
  Crypto crypto=CRYPTO_MAP.get(algorithm);
  if (crypto == null) {
    throw new RuntimeException("String_Node_Str");
  }
  JsonObject header=new JsonObject().putString("String_Node_Str","String_Node_Str").putString("String_Node_Str",algorithm);
  String headerSegment=base64urlEncode(header.encode());
  String payloadSegment=base64urlEncode(payload.encode());
  String signingInput=headerSegment + "String_Node_Str" + payloadSegment;
  String signSegment=base64urlEscape(Base64.encodeBytes(crypto.sign(signingInput.getBytes())));
  return headerSegment + "String_Node_Str" + payloadSegment+ "String_Node_Str"+ signSegment;
}

Fixed version (ground truth):
public String encode(JsonObject payload,String algorithm){
  Crypto crypto=CRYPTO_MAP.get(algorithm);
  if (crypto == null) {
    throw new RuntimeException("String_Node_Str");
  }
  JsonObject header=new JsonObject().putString("String_Node_Str","String_Node_Str").putString("String_Node_Str",algorithm);
  String headerSegment=base64urlEncode(header.encode());
  String payloadSegment=base64urlEncode(payload.encode());
  String signingInput=headerSegment + "String_Node_Str" + payloadSegment;
  String signSegment=base64urlEscape(Base64.encodeBytes(crypto.sign(signingInput.getBytes()),Base64.DONT_BREAK_LINES));
  return headerSegment + "String_Node_Str" + payloadSegment+ "String_Node_Str"+ signSegment;
}
Program: 56289
Project: 56289
Buggy source:
private static String base64urlDecode(String str){
  return new String(Base64.decode(base64urlUnescape(str)));
}

Fixed version (ground truth):
private static String base64urlDecode(String str){
  return new String(Base64.decode(base64urlUnescape(str),Base64.DONT_BREAK_LINES));
}
Program: 56290
Project: 56290
Buggy source:
public JsonObject decode(final String token,boolean noVerify){
  String[] segments=token.split("String_Node_Str");
  if (segments.length != 3) {
    throw new RuntimeException("String_Node_Str");
  }
  String headerSeg=segments[0];
  String payloadSeg=segments[1];
  String signatureSeg=segments[2];
  JsonObject header=new JsonObject(base64urlDecode(headerSeg));
  JsonObject payload=new JsonObject(base64urlDecode(payloadSeg));
  if (!noVerify) {
    Crypto crypto=CRYPTO_MAP.get(header.getString("String_Node_Str"));
    if (crypto == null) {
      throw new RuntimeException("String_Node_Str");
    }
    String signingInput=headerSeg + "String_Node_Str" + payloadSeg;
    if (!crypto.verify(signatureSeg.getBytes(),signingInput.getBytes())) {
      throw new RuntimeException("String_Node_Str");
    }
  }
  return payload;
}

Fixed version (ground truth):
public JsonObject decode(final String token,boolean noVerify){
  String[] segments=token.split("String_Node_Str");
  if (segments.length != 3) {
    throw new RuntimeException("String_Node_Str");
  }
  String headerSeg=segments[0];
  String payloadSeg=segments[1];
  String signatureSeg=segments[2];
  JsonObject header=new JsonObject(base64urlDecode(headerSeg));
  JsonObject payload=new JsonObject(base64urlDecode(payloadSeg));
  if (!noVerify) {
    Crypto crypto=CRYPTO_MAP.get(header.getString("String_Node_Str"));
    if (crypto == null) {
      throw new RuntimeException("String_Node_Str");
    }
    String signingInput=headerSeg + "String_Node_Str" + payloadSeg;
    if (!crypto.verify(Base64.decode(base64urlUnescape(signatureSeg),Base64.DONT_BREAK_LINES),signingInput.getBytes())) {
      throw new RuntimeException("String_Node_Str");
    }
  }
  return payload;
}
Program: 56291
Project: 56291
Buggy source:
private static String base64urlEncode(String str){
  return base64urlEscape(Base64.encodeBytes(str.getBytes()));
}

Fixed version (ground truth):
private static String base64urlEncode(String str){
  return base64urlEscape(Base64.encodeBytes(str.getBytes(),Base64.DONT_BREAK_LINES));
}
Program: 56292
Project: 56292
Buggy source:
public Object getAt(String key){
  List<String> out=impl.getAll(key);
  if (out != null) {
    if (out.size() == 1) {
      return out.get(0);
    }
  }
  return out;
}

Fixed version (ground truth):
public Object getAt(String key){
  List<String> out=impl.getAll(key);
  if (out != null) {
    if (out.size() == 1) {
      return out.get(0);
    }
    if (out.size() == 0) {
      return null;
    }
  }
  return out;
}
Program: 56293
Project: 56293
Buggy source:
@Override public void handle(YokeRequest request,Handler<Object> next){
  try {
    if (consumes != null) {
      boolean canConsume=false;
      for (      String c : consumes) {
        if (request.is(c)) {
          canConsume=true;
          break;
        }
      }
      if (!canConsume) {
        next.handle(415);
        return;
      }
    }
    if (produces != null) {
      String bestContentType=request.accepts(produces);
      if (bestContentType == null) {
        next.handle(406);
        return;
      }
      request.response().setContentType(bestContentType);
    }
    m.invoke(o,request,next);
  }
 catch (  Throwable e) {
    next.handle(e);
  }
}

Fixed version (ground truth):
@Override public void handle(Object err){
  if (err == null) {
    next();
  }
 else {
    next.handle(err);
  }
}
Program: 56294
Project: 56294
Buggy source:
private void route(final YokeRequest request,final PatternBinding binding,final Handler<Object> next){
  final Matcher m=binding.pattern.matcher(request.path());
  if (m.matches()) {
    final MultiMap params=request.params();
    if (binding.paramNames != null) {
      new AsyncIterator<String>(binding.paramNames){
        @Override public void handle(        String param){
          if (hasNext()) {
            params.add(param,m.group(param));
            Middleware paramMiddleware=paramProcessors.get(param);
            if (paramMiddleware != null) {
              paramMiddleware.handle(request,new Handler<Object>(){
                @Override public void handle(                Object err){
                  if (err == null) {
                    next();
                  }
 else {
                    next.handle(err);
                  }
                }
              }
);
            }
 else {
              next();
            }
          }
 else {
            binding.middleware.handle(request,next);
          }
        }
      }
;
    }
 else {
      for (int i=0; i < m.groupCount(); i++) {
        params.add("String_Node_Str" + i,m.group(i + 1));
      }
      binding.middleware.handle(request,next);
    }
  }
 else {
    next.handle(null);
  }
}

Fixed version (ground truth):
private void route(final YokeRequest request,final PatternBinding binding,final Handler<Object> next){
  final Matcher m=binding.pattern.matcher(request.path());
  if (m.matches()) {
    final MultiMap params=request.params();
    if (binding.paramNames != null) {
      new AsyncIterator<String>(binding.paramNames){
        @Override public void handle(        String param){
          if (hasNext()) {
            params.set(param,m.group(param));
            Middleware paramMiddleware=paramProcessors.get(param);
            if (paramMiddleware != null) {
              paramMiddleware.handle(request,new Handler<Object>(){
                @Override public void handle(                Object err){
                  if (err == null) {
                    next();
                  }
 else {
                    next.handle(err);
                  }
                }
              }
);
            }
 else {
              next();
            }
          }
 else {
            binding.middleware.handle(request,next);
          }
        }
      }
;
    }
 else {
      for (int i=0; i < m.groupCount(); i++) {
        params.set("String_Node_Str" + i,m.group(i + 1));
      }
      binding.middleware.handle(request,next);
    }
  }
 else {
    next.handle(null);
  }
}
Program: 56295
Project: 56295
Buggy source:
public HandlebarsEngine(final String views){
  super(null);
  if ("String_Node_Str".equals(views)) {
    prefix=views;
  }
 else {
    prefix=views.endsWith("String_Node_Str") ? views : views + "String_Node_Str";
  }
  handlebars=new Handlebars(new TemplateLoader(){
    @Override public TemplateSource sourceAt(    final String location) throws IOException {
      try {
        return new TemplateSource(){
          @Override public String content() throws IOException {
            return read(resolve(location));
          }
          @Override public String filename(){
            return location;
          }
          @Override public long lastModified(){
            return HandlebarsEngine.this.lastModified(location);
          }
        }
;
      }
 catch (      Exception e) {
        e.printStackTrace();
        throw new IOException(e);
      }
    }
    @Override public String resolve(    String location){
      return HandlebarsEngine.this.resolve(location);
    }
    @Override public String getPrefix(){
      return prefix;
    }
    @Override public String getSuffix(){
      return extension;
    }
  }
);
}

Fixed version (ground truth):
public HandlebarsEngine(final String views){
  super(null);
  if ("String_Node_Str".equals(views)) {
    prefix=views;
  }
 else {
    prefix=views.endsWith("String_Node_Str") ? views : views + "String_Node_Str";
  }
  handlebars=new Handlebars(new TemplateLoader(){
    @Override public TemplateSource sourceAt(    final String location) throws IOException {
      final String buffer=read(resolve(location));
      if (buffer == null) {
        throw new FileNotFoundException(location);
      }
      return new TemplateSource(){
        @Override public String content() throws IOException {
          return buffer;
        }
        @Override public String filename(){
          return location;
        }
        @Override public long lastModified(){
          return HandlebarsEngine.this.lastModified(location);
        }
      }
;
    }
    @Override public String resolve(    String location){
      return HandlebarsEngine.this.resolve(location);
    }
    @Override public String getPrefix(){
      return prefix;
    }
    @Override public String getSuffix(){
      return extension;
    }
  }
);
}
Program: 56296
Project: 56296
Buggy source:
@Override public TemplateSource sourceAt(final String location) throws IOException {
  try {
    return new TemplateSource(){
      @Override public String content() throws IOException {
        return read(resolve(location));
      }
      @Override public String filename(){
        return location;
      }
      @Override public long lastModified(){
        return HandlebarsEngine.this.lastModified(location);
      }
    }
;
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new IOException(e);
  }
}

Fixed version (ground truth):
@Override public TemplateSource sourceAt(final String location) throws IOException {
  final String buffer=read(resolve(location));
  if (buffer == null) {
    throw new FileNotFoundException(location);
  }
  return new TemplateSource(){
    @Override public String content() throws IOException {
      return buffer;
    }
    @Override public String filename(){
      return location;
    }
    @Override public long lastModified(){
      return HandlebarsEngine.this.lastModified(location);
    }
  }
;
}
Program: 56297
Project: 56297
Buggy source:
@Override public String content() throws IOException {
  return read(resolve(location));
}

Fixed version (ground truth):
@Override public String content() throws IOException {
  return buffer;
}
Program: 56298
Project: 56298
Buggy source:
@Test public void testEngine(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    FileOutputStream out=new FileOutputStream(temp);
    out.write("String_Node_Str".getBytes());
    out.close();
    final String location=temp.getAbsolutePath();
    Yoke yoke=new Yoke(this);
    yoke.engine("String_Node_Str",new com.jetdrone.vertx.yoke.extras.engine.Jade4JEngine());
    yoke.use(new Middleware(){
      @Override public void handle(      YokeRequest request,      Handler<Object> next){
        request.response().render(location,next);
      }
    }
);
    new YokeTester(vertx,yoke).request("String_Node_Str","String_Node_Str",new Handler<Response>(){
      @Override public void handle(      Response resp){
        assertEquals(200,resp.getStatusCode());
        assertEquals("String_Node_Str",resp.body.toString());
        testComplete();
      }
    }
);
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testEngine(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    FileOutputStream out=new FileOutputStream(temp);
    out.write("String_Node_Str".getBytes());
    out.close();
    final String location=temp.getAbsolutePath();
    Yoke yoke=new Yoke(this);
    yoke.engine("String_Node_Str",new com.jetdrone.vertx.yoke.extras.engine.Jade4JEngine("String_Node_Str","String_Node_Str"));
    yoke.use(new Middleware(){
      @Override public void handle(      YokeRequest request,      Handler<Object> next){
        request.response().render(location,next);
      }
    }
);
    new YokeTester(vertx,yoke).request("String_Node_Str","String_Node_Str",new Handler<Response>(){
      @Override public void handle(      Response resp){
        assertEquals(200,resp.getStatusCode());
        assertEquals("String_Node_Str",resp.body.toString());
        testComplete();
      }
    }
);
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 56299
Project: 56299
Buggy source:
@Test public void testEngine2(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    FileOutputStream out=new FileOutputStream(temp);
    String template="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    out.write(template.getBytes());
    out.close();
    final String location=temp.getAbsolutePath();
    Yoke yoke=new Yoke(this);
    yoke.engine("String_Node_Str",new com.jetdrone.vertx.yoke.extras.engine.Jade4JEngine());
    yoke.use(new Middleware(){
      @Override public void handle(      YokeRequest request,      Handler<Object> next){
        request.put("String_Node_Str","String_Node_Str");
        request.response().render(location,next);
      }
    }
);
    new YokeTester(vertx,yoke).request("String_Node_Str","String_Node_Str",new Handler<Response>(){
      @Override public void handle(      Response resp){
        assertEquals(200,resp.getStatusCode());
        assertEquals("String_Node_Str",resp.body.toString());
        testComplete();
      }
    }
);
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testEngine2(){
  try {
    File temp=File.createTempFile("String_Node_Str","String_Node_Str");
    FileOutputStream out=new FileOutputStream(temp);
    String template="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    out.write(template.getBytes());
    out.close();
    final String location=temp.getAbsolutePath();
    Yoke yoke=new Yoke(this);
    yoke.engine("String_Node_Str",new com.jetdrone.vertx.yoke.extras.engine.Jade4JEngine("String_Node_Str","String_Node_Str"));
    yoke.use(new Middleware(){
      @Override public void handle(      YokeRequest request,      Handler<Object> next){
        request.put("String_Node_Str","String_Node_Str");
        request.response().render(location,next);
      }
    }
);
    new YokeTester(vertx,yoke).request("String_Node_Str","String_Node_Str",new Handler<Response>(){
      @Override public void handle(      Response resp){
        assertEquals(200,resp.getStatusCode());
        assertEquals("String_Node_Str",resp.body.toString());
        testComplete();
      }
    }
);
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 56300
Project: 56300
Buggy source:
@Override public void handle(YokeRequest request,Handler<Object> next){
  String token=request.get(key);
  if (token == null) {
    token=UUID.randomUUID().toString();
    request.put(key,token);
  }
  if ("String_Node_Str".equals(request.method()) || "String_Node_Str".equals(request.method()) || "String_Node_Str".equals(request.method())) {
    next.handle(null);
    return;
  }
  String val=valueHandler.handle(request);
  if (!token.equals(val)) {
    next.handle(403);
  }
  next.handle(null);
}

Fixed version (ground truth):
@Override public void handle(YokeRequest request,Handler<Object> next){
  String token=request.get(key);
  if (token == null) {
    token=UUID.randomUUID().toString();
    request.put(key,token);
  }
  if ("String_Node_Str".equals(request.method()) || "String_Node_Str".equals(request.method()) || "String_Node_Str".equals(request.method())) {
    next.handle(null);
    return;
  }
  request.expectMultiPart(true);
  String val=valueHandler.handle(request);
  if (!token.equals(val)) {
    next.handle(403);
    return;
  }
  next.handle(null);
}
Program: 56301
Project: 56301
Buggy source:
@Override public HttpServerRequest expectMultiPart(boolean expect){
  request.expectMultiPart(expect);
  return this;
}

Fixed version (ground truth):
@Override public HttpServerRequest expectMultiPart(boolean expect){
  if (expect) {
    if (!expectMultiPartCalled) {
      expectMultiPartCalled=true;
      request.expectMultiPart(expect);
    }
  }
 else {
    expectMultiPartCalled=false;
    request.expectMultiPart(expect);
  }
  return this;
}
Program: 56302
Project: 56302
Buggy source:
public Object getJson(){
  Object _body=body();
  if (_body != null && _body instanceof String) {
    char initial=((String)_body).charAt(0);
    if (initial == '{') {
      JsonSlurper slurper=new JsonSlurper();
      return slurper.parseText((String)_body);
    }
  }
  return null;
}

Fixed version (ground truth):
public Object getJson(){
  Object _body=body();
  if (_body != null && _body instanceof String) {
    Boolean validObject=(Boolean)get("String_Node_Str");
    Boolean validArray=(Boolean)get("String_Node_Str");
    if (validObject != null && validObject) {
      return parseText((String)_body);
    }
    if (validArray != null && validArray) {
      return parseText((String)_body);
    }
  }
  return null;
}
Program: 56303
Project: 56303
Buggy source:
private void parseJson(final YokeRequest request,final Buffer buffer,final Handler<Object> next){
  try {
    String content=buffer.toString();
    if (content.length() > 0) {
      char initial=content.charAt(0);
      if (initial == '{' || initial == '[') {
        request.setBody(content);
        next.handle(null);
      }
 else {
        next.handle(400);
      }
    }
 else {
      next.handle(400);
    }
  }
 catch (  DecodeException ex) {
    next.handle(ex);
  }
}

Fixed version (ground truth):
private void parseJson(final YokeRequest request,final Buffer buffer,final Handler<Object> next){
  try {
    String content=buffer.toString();
    if (content.length() > 0) {
switch (content.charAt(0)) {
case '{':
        request.setBody(content);
      request.put("String_Node_Str",true);
    next.handle(null);
  break;
case '[':
request.setBody(content);
request.put("String_Node_Str",true);
next.handle(null);
break;
default :
next.handle(400);
}
}
 else {
next.handle(400);
}
}
 catch (DecodeException ex) {
next.handle(ex);
}
}
Program: 56304
Project: 56304
Buggy source:
/** 
 * The request setBody and eventually a parsed version of it in json or map
 */
public JsonObject jsonBody(){
  if (body != null && body instanceof String) {
    char initial=((String)body).charAt(0);
    if (initial == '{') {
      return new JsonObject((String)body);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * A parsed Json Array if body is detected to contain a valid String for Json Object.
 */
public JsonObject jsonBody(){
  if (body != null && body instanceof String) {
    Boolean flag=(Boolean)get("String_Node_Str");
    if (flag != null && flag) {
      return new JsonObject((String)body);
    }
  }
  return null;
}
Program: 56305
Project: 56305
Buggy source:
/** 
 * Check if the given type(s) is acceptable, returning the best match when true, otherwise null, in which case you should respond with 406 "Not Acceptable". The type value must be a single mime type string such as "application/json" and is validated by checking if the request string starts with it.
 */
public String accepts(String... types){
  String accept=getHeader("String_Node_Str");
  if (accept == null) {
    return types[0];
  }
  String[] acceptTypes=accept.split("String_Node_Str");
  Arrays.sort(acceptTypes,ACCEPT_X_COMPARATOR);
  for (  String senderAccept : acceptTypes) {
    for (    String appAccept : types) {
      if (senderAccept.startsWith(appAccept)) {
        return senderAccept;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Check if the given type(s) is acceptable, returning the best match when true, otherwise null, in which case you should respond with 406 "Not Acceptable". The type value must be a single mime type string such as "application/json" and is validated by checking if the request string starts with it.
 */
public String accepts(String... types){
  String accept=getHeader("String_Node_Str");
  if (accept == null) {
    return types[0];
  }
  String[] acceptTypes=accept.split("String_Node_Str");
  Arrays.sort(acceptTypes,ACCEPT_X_COMPARATOR);
  for (  String senderAccept : acceptTypes) {
    String[] sAccept=splitMime(senderAccept);
    for (    String appAccept : types) {
      String[] aAccept=splitMime(appAccept);
      if ((sAccept[0].equals(aAccept[0]) || "String_Node_Str".equals(sAccept[0]) || "String_Node_Str".equals(aAccept[0])) && (sAccept[1].equals(aAccept[1]) || "String_Node_Str".equals(sAccept[1]) || "String_Node_Str".equals(aAccept[1]))) {
        return senderAccept;
      }
    }
  }
  return null;
}
Program: 56307
Project: 56307
Buggy source:
@Override public void handle(final YokeRequest request,final Handler<Object> next){
  final Map<String,String> urlEncoded=request.formAttributes();
  if (urlEncoded != null) {
    String method=urlEncoded.get(key);
    if (method != null) {
      urlEncoded.remove(key);
      request.setMethod(method);
      next.handle(null);
      return;
    }
  }
  final JsonObject json=request.jsonBody();
  if (json != null) {
    String method=json.getString(key);
    if (method != null) {
      json.removeField(key);
      request.setMethod(method);
      next.handle(null);
      return;
    }
  }
  String xHttpMethodOverride=request.getHeader("String_Node_Str");
  if (xHttpMethodOverride != null) {
    request.setMethod(xHttpMethodOverride);
    next.handle(null);
  }
}

Fixed version (ground truth):
@Override public void handle(final YokeRequest request,final Handler<Object> next){
  final Map<String,String> urlEncoded=request.formAttributes();
  if (urlEncoded != null) {
    String method=urlEncoded.get(key);
    if (method != null) {
      urlEncoded.remove(key);
      request.setMethod(method);
      next.handle(null);
      return;
    }
  }
  final JsonObject json=request.jsonBody();
  if (json != null) {
    String method=json.getString(key);
    if (method != null) {
      json.removeField(key);
      request.setMethod(method);
      next.handle(null);
      return;
    }
  }
  String xHttpMethodOverride=request.getHeader("String_Node_Str");
  if (xHttpMethodOverride != null) {
    request.setMethod(xHttpMethodOverride);
  }
  next.handle(null);
}
Program: 56309
Project: 56309
Buggy source:
@Override public void setVertx(Vertx vertx){
  try {
    super.setVertx(vertx);
    if (path == null) {
      icon=new Icon(Utils.readResourceToBuffer(getClass(),"String_Node_Str"));
    }
 else {
      icon=new Icon(vertx.fileSystem().readFileSync(path));
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public Middleware setVertx(Vertx vertx){
  try {
    super.setVertx(vertx);
    if (path == null) {
      icon=new Icon(Utils.readResourceToBuffer(getClass(),"String_Node_Str"));
    }
 else {
      icon=new Icon(vertx.fileSystem().readFileSync(path));
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return this;
}
Program: 56310
Project: 56310
Buggy source:
@Override public void handle(Object error){
  if (error == null) {
    currentMiddleware++;
    if (currentMiddleware < middlewareList.size()) {
      MountedMiddleware mountedMiddleware=middlewareList.get(currentMiddleware);
      if (request.path().startsWith(mountedMiddleware.mount)) {
        Middleware middlewareItem=mountedMiddleware.middleware;
        middlewareItem.handle(request,this);
      }
 else {
        handle(null);
      }
    }
 else {
      HttpServerResponse response=request.response();
      response.setStatusCode(404);
      response.setStatusMessage(HttpResponseStatus.valueOf(404).reasonPhrase());
      if (errorHandler != null) {
        errorHandler.handle(request,null);
      }
 else {
        response.end(HttpResponseStatus.valueOf(404).reasonPhrase());
      }
    }
  }
 else {
    request.put("String_Node_Str",error);
    if (errorHandler != null) {
      errorHandler.handle(request,null);
    }
 else {
      HttpServerResponse response=request.response();
      if (error instanceof Integer) {
        int code=(Integer)error;
        response.setStatusCode(code);
        response.setStatusMessage(HttpResponseStatus.valueOf(code).reasonPhrase());
        response.end(HttpResponseStatus.valueOf(code).reasonPhrase());
      }
 else {
        response.setStatusCode(500);
        response.setStatusMessage(HttpResponseStatus.valueOf(500).reasonPhrase());
        response.end(HttpResponseStatus.valueOf(500).reasonPhrase());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void handle(Object error){
  if (error == null) {
    currentMiddleware++;
    if (currentMiddleware < middlewareList.size()) {
      MountedMiddleware mountedMiddleware=middlewareList.get(currentMiddleware);
      if (request.path().startsWith(mountedMiddleware.mount)) {
        Middleware middlewareItem=mountedMiddleware.middleware;
        middlewareItem.handle(request,this);
      }
 else {
        handle(null);
      }
    }
 else {
      HttpServerResponse response=request.response();
      response.setStatusCode(404);
      response.setStatusMessage(HttpResponseStatus.valueOf(404).reasonPhrase());
      if (errorHandler != null) {
        errorHandler.handle(request,null);
      }
 else {
        response.end(HttpResponseStatus.valueOf(404).reasonPhrase());
      }
    }
  }
 else {
    request.put("String_Node_Str",error);
    if (errorHandler != null) {
      errorHandler.handle(request,null);
    }
 else {
      HttpServerResponse response=request.response();
      int errorCode=500;
      if (response.getStatusCode() >= 400) {
        errorCode=response.getStatusCode();
      }
      if (error instanceof Integer) {
        errorCode=(Integer)error;
      }
      response.setStatusCode(errorCode);
      response.setStatusMessage(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
      response.end(HttpResponseStatus.valueOf(errorCode).reasonPhrase());
    }
  }
}
Program: 56312
Project: 56312
Buggy source:
public void close(){
  try {
    getEntityManagerFactory().close();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void close(){
  try {
    if (entityManagerProvider.getEntityManagerFactory().isOpen()) {
      entityManagerProvider.getEntityManagerFactory().close();
    }
 else {
      logger.info("String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str",e);
  }
}
Program: 56313
Project: 56313
Buggy source:
public EntityManager getEntityManager(){
  if (entityManager == null) {
    entityManager=config.getEntityManagerFactory().createEntityManager();
    if (readOnly) {
      entityManager.setProperty("String_Node_Str",readOnly);
    }
  }
  return entityManager;
}

Fixed version (ground truth):
public EntityManager getEntityManager(){
  if (entityManager == null) {
    entityManager=config.getEntityManagerProvider().getEntityManager();
    if (readOnly) {
      entityManager.setProperty("String_Node_Str",readOnly);
    }
  }
  return entityManager;
}
Program: 56314
Project: 56314
Buggy source:
@Test public void shouldClose(){
  config.close();
  verify(emf).close();
}

Fixed version (ground truth):
@Test public void shouldClose(){
  when(emf.isOpen()).thenReturn(true);
  config.close();
  verify(emf).close();
}