nus-yam/ex-repair huggingface dataset:
Program: 42340
Project: 42340
Buggy source:
public void load(List<XValue> files,String baseUri,boolean bRecurse) throws CoreException, IOException, RequestException {
  printErr("String_Node_Str" + files.size() + "String_Node_Str"+ baseUri);
  List<Content> contents=new ArrayList<Content>(files.size());
  int i=0;
  for (  XValue v : files) {
    String fname=v.toString();
    File file=getFile(fname);
    String uri=baseUri + file.getName() + "String_Node_Str";
    if (file.isDirectory()) {
      if (!bRecurse) {
        printErr("String_Node_Str" + file.getName());
        continue;
      }
      List<XValue> sub=new ArrayList<XValue>();
      for (      String fn : file.list()) {
        sub.add(new XValue(fname + "String_Node_Str" + fn));
      }
      createDir(uri);
      if (!sub.isEmpty())       load(sub,uri,bRecurse);
      continue;
    }
    Content content=ContentFactory.newContent(uri,file,options);
    contents.add(content);
  }
  if (!contents.isEmpty())   session.insertContent(contents.toArray(new Content[contents.size()]));
}

Fixed version (ground truth):
public void load(List<XValue> files,String baseUri,boolean bRecurse) throws CoreException, IOException, RequestException {
  printErr("String_Node_Str" + files.size() + "String_Node_Str"+ baseUri);
  List<Content> contents=new ArrayList<Content>(files.size());
  int i=0;
  for (  XValue v : files) {
    String fname=v.toString();
    File file=getFile(fname);
    String uri=baseUri + file.getName();
    if (file.isDirectory()) {
      if (!bRecurse) {
        printErr("String_Node_Str" + file.getName());
        continue;
      }
      List<XValue> sub=new ArrayList<XValue>();
      for (      String fn : file.list()) {
        sub.add(new XValue(fname + "String_Node_Str" + fn));
      }
      createDir(uri + "String_Node_Str");
      if (!sub.isEmpty())       load(sub,uri + "String_Node_Str",bRecurse);
      continue;
    }
    Content content=ContentFactory.newContent(uri,file,options);
    contents.add(content);
  }
  if (!contents.isEmpty())   session.insertContent(contents.toArray(new Content[contents.size()]));
}
Program: 42341
Project: 42341
Buggy source:
public static boolean wildMatches(String pattern,String word){
  String reg="String_Node_Str" + pattern.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  if (reg.equals("String_Node_Str"))   reg="String_Node_Str";
  return word.matches(reg);
}

Fixed version (ground truth):
public static boolean wildMatches(String pattern,String word,boolean caseSensitive){
  String reg="String_Node_Str" + pattern.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  if (reg.equals("String_Node_Str"))   reg="String_Node_Str";
  Pattern p=Pattern.compile(reg,caseSensitive ? 0 : Pattern.CASE_INSENSITIVE);
  return p.matcher(word).matches();
}
Program: 42342
Project: 42342
Buggy source:
public boolean matches(String word){
  for (  String pattern : mPattern) {
    if (Util.wildMatches(pattern,word))     return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean matches(String word){
  for (  String pattern : mPattern) {
    if (Util.wildMatches(pattern,word,true))     return true;
  }
  return false;
}
Program: 42343
Project: 42343
Buggy source:
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  String file=mFile.expandString(shell,false);
  boolean isPort=file.startsWith("String_Node_Str") && file.endsWith("String_Node_Str");
  if (isPort) {
    String var=file.substring(1,file.length() - 1);
    if (mPrefix.equals("String_Node_Str"))     env.setStdin(env.getVar(var));
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=new XVariable(var,null);
      env.setVar(xvar);
      env.setStdout(xvar);
    }
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=env.getVar(var);
      if (var == null) {
        xvar=new XVariable(var,null);
        env.setVar(xvar);
      }
      env.setStdout(xvar);
    }
    return;
  }
  if (mPrefix.equals("String_Node_Str")) {
    env.setStdin(shell.getInputStream(file));
    env.getStdin().setSystemId(file);
  }
 else   if (mPrefix.equals("String_Node_Str"))   env.setStderr(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,true));
}

Fixed version (ground truth):
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  String file=mFile.expandString(shell,true);
  boolean isPort=file.startsWith("String_Node_Str") && file.endsWith("String_Node_Str");
  if (isPort) {
    String var=file.substring(1,file.length() - 1);
    if (mPrefix.equals("String_Node_Str"))     env.setStdin(env.getVar(var));
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=new XVariable(var,null);
      env.setVar(xvar);
      env.setStdout(xvar);
    }
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=env.getVar(var);
      if (var == null) {
        xvar=new XVariable(var,null);
        env.setVar(xvar);
      }
      env.setStdout(xvar);
    }
    return;
  }
  if (mPrefix.equals("String_Node_Str")) {
    env.setStdin(shell.getInputStream(file));
    env.getStdin().setSystemId(file);
  }
 else   if (mPrefix.equals("String_Node_Str"))   env.setStderr(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,true));
}
Program: 42344
Project: 42344
Buggy source:
private List<XValue> expandWild(XValue v){
  ArrayList<XValue> r=new ArrayList<XValue>();
  if (v.isXExpr()) {
    r.add(v);
    return r;
  }
  String vs=v.toString();
  int vslen=vs.length();
  StringBuffer sb=new StringBuffer();
  char cQuote=0;
  boolean wildUnQuoted=false;
  for (int i=0; i < vslen; i++) {
    char c=vs.charAt(i);
    if (c == '\\' && i < vslen) {
      c=vs.charAt(++i);
      if (c != '"' && c != '\'')       sb.append('\\');
      sb.append(c);
      continue;
    }
    if (c == '"' || c == '\'') {
      if (c == cQuote) {
        cQuote=0;
        continue;
      }
 else       if (cQuote == 0) {
        cQuote=c;
        continue;
      }
    }
    if (cQuote == 0 && (c == '*' || c == '?' || c == '['))     wildUnQuoted=true;
    sb.append(c);
  }
  if (!wildUnQuoted) {
    r.add(new XValue(sb.toString()));
    return r;
  }
  vs=sb.toString();
  List<String> rs=new ArrayList<String>();
  String wilds[]=vs.split("String_Node_Str");
  expandDir(mShell.getCurdir(),null,wilds,rs);
  for (  String f : rs) {
    r.add(new XValue(f));
  }
  if (r.size() == 0)   r.add(v);
  return r;
}

Fixed version (ground truth):
private List<XValue> expandWild(XValue v){
  ArrayList<XValue> r=new ArrayList<XValue>();
  if (v.isXExpr()) {
    r.add(v);
    return r;
  }
  String vs=v.toString();
  int vslen=vs.length();
  StringBuffer sb=new StringBuffer();
  char cQuote=0;
  boolean wildUnQuoted=false;
  for (int i=0; i < vslen; i++) {
    char c=vs.charAt(i);
    if (c == '\\' && i < vslen) {
      c=vs.charAt(++i);
      if (c != '"' && c != '\'')       sb.append('\\');
      sb.append(c);
      continue;
    }
    if (c == '"' || c == '\'') {
      if (c == cQuote) {
        cQuote=0;
        continue;
      }
 else       if (cQuote == 0) {
        cQuote=c;
        continue;
      }
    }
    if (cQuote == 0 && (c == '*' || c == '?' || c == '['))     wildUnQuoted=true;
    sb.append(c);
  }
  if (!wildUnQuoted) {
    r.add(new XValue(sb.toString()));
    return r;
  }
  vs=sb.toString();
  List<String> rs=new ArrayList<String>();
  vs=vs.replaceAll("String_Node_Str","String_Node_Str");
  String root=null;
  String parent=null;
  if (vs.startsWith("String_Node_Str")) {
    root="String_Node_Str";
    parent="String_Node_Str";
    vs=vs.substring(1);
  }
  if (Util.isWindows() && vs.matches("String_Node_Str")) {
    root=vs.substring(0,2);
    vs=vs.substring(2);
    if (vs.startsWith("String_Node_Str"))     vs=vs.substring(1);
    parent=root;
  }
  String wilds[]=vs.split("String_Node_Str");
  expandDir(root == null ? mShell.getCurdir() : new File(root),parent,wilds,rs);
  for (  String f : rs) {
    r.add(new XValue(f));
  }
  if (r.size() == 0)   r.add(v);
  return r;
}
Program: 42346
Project: 42346
Buggy source:
public int run(List<XValue> args) throws Exception {
  OutputPort stdout=mShell.getEnv().getStdout();
  Destination dest=stdout.asDestination();
  Processor processor=Shell.getProcessor();
  args=Util.expandSequences(args);
  boolean bFirst=true;
  for (  XValue arg : args) {
    if (!bFirst)     stdout.writeSequenceSeperator();
    bFirst=false;
    processor.writeXdmValue(arg.asXdmValue(),dest);
  }
  stdout.writeSequenceTerminator();
  return 0;
}

Fixed version (ground truth):
public int run(List<XValue> args) throws Exception {
  OutputPort stdout=mShell.getEnv().getStdout();
  Destination dest=stdout.asDestination();
  Processor processor=Shell.getProcessor();
  args=Util.expandSequences(args);
  boolean bFirst=true;
  for (  XValue arg : args) {
    if (!bFirst)     stdout.writeSequenceSeperator();
 else {
      XdmValue item=arg.asXdmValue();
      if (item instanceof XdmNode) {
        URI uri=((XdmNode)item).getBaseURI();
        stdout.setSystemId(uri.toString());
      }
    }
    bFirst=false;
    processor.writeXdmValue(arg.asXdmValue(),dest);
  }
  stdout.writeSequenceTerminator();
  return 0;
}
Program: 42347
Project: 42347
Buggy source:
final synchronized void release() throws CoreException {
  if (--mRef <= 0)   try {
    close();
  }
 catch (  Exception e) {
    throw new CoreException("String_Node_Str");
  }
}

Fixed version (ground truth):
final synchronized void release() throws CoreException {
  try {
    flush();
    if (--mRef <= 0)     close();
  }
 catch (  Exception e) {
    throw new CoreException("String_Node_Str");
  }
}
Program: 42348
Project: 42348
Buggy source:
private void appendVar(XdmItem xitem) throws InvalidArgumentException {
  XValue value=mVariable.getValue();
  if (value == null)   mVariable.setValue(new XValue(xitem));
 else {
    mVariable.setValue(value.append(xitem));
  }
}

Fixed version (ground truth):
private void appendVar(XdmItem xitem) throws InvalidArgumentException {
  if (xitem instanceof XdmNode) {
    XdmNode node=(XdmNode)xitem;
    node.getUnderlyingNode().setSystemId(getSystemId());
  }
  XValue value=mVariable.getValue();
  if (value == null)   mVariable.setValue(new XValue(xitem));
 else {
    mVariable.setValue(value.append(xitem));
  }
}
Program: 42349
Project: 42349
Buggy source:
public synchronized void close() throws IOException, InvalidArgumentException {
  if (mStream != null)   mStream.close();
  if (mVariable != null) {
    if (mXdmDestination != null)     appendVar(mXdmDestination.getXdmNode());
    if (mByteArrayOutputStream != null)     appendVar(mByteArrayOutputStream.toString(Shell.getTextEncoding()));
    if (mBuilder != null)     appendVar((XdmNode)S9Util.wrapNode(mBuilder.getCurrentRoot()));
  }
}

Fixed version (ground truth):
public synchronized void close() throws IOException, InvalidArgumentException {
  if (mStream != null)   mStream.close();
}
Program: 42350
Project: 42350
Buggy source:
public void initStdio() throws IOException {
  mInputs.add(new NamedPort<InputPort>(null,true,new InputPort(System.in,"String_Node_Str")));
  mOutputs.add(new NamedPort<OutputPort>(null,true,new OutputPort(System.out)));
  mOutputs.add(new NamedPort<OutputPort>(kSTDERR,false,new OutputPort(System.err)));
}

Fixed version (ground truth):
public void initStdio() throws IOException {
  mInputs.add(new NamedPort<InputPort>(null,true,new InputPort(System.in)));
  mOutputs.add(new NamedPort<OutputPort>(null,true,new OutputPort(System.out)));
  mOutputs.add(new NamedPort<OutputPort>(kSTDERR,false,new OutputPort(System.err)));
}
Program: 42351
Project: 42351
Buggy source:
public PipedStream(String systemId) throws IOException {
  super(systemId);
  mOut=new PipedOutputStream();
  mIn=new PipedInputStream(mOut);
}

Fixed version (ground truth):
public PipedStream() throws IOException {
  mOut=new PipedOutputStream();
  mIn=new PipedInputStream(mOut);
}
Program: 42352
Project: 42352
Buggy source:
static public PipedStream[] getPipes(int n) throws IOException {
  if (n == 0)   return null;
  PipedStream streams[]=new PipedStream[n];
  for (int i=0; i < n; i++)   streams[i]=new PipedStream("String_Node_Str");
  return streams;
}

Fixed version (ground truth):
static public PipedStream[] getPipes(int n) throws IOException {
  if (n == 0)   return null;
  PipedStream streams[]=new PipedStream[n];
  for (int i=0; i < n; i++)   streams[i]=new PipedStream();
  return streams;
}
Program: 42353
Project: 42353
Buggy source:
public InputPort getInput() throws IOException {
  return new InputPort(mIn,mSystemId);
}

Fixed version (ground truth):
public InputPort getInput() throws IOException {
  return new InputPort(mIn);
}
Program: 42354
Project: 42354
Buggy source:
private String expandSubproc(Shell shell,Command c) throws CoreException {
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  shell=shell.clone();
  try {
    shell.getEnv().setStdout(out);
    shell.getEnv().setStdin(new NullInputStream(),"String_Node_Str");
    shell.exec(c);
    return out.toString().trim();
  }
  finally {
    shell.close();
  }
}

Fixed version (ground truth):
private String expandSubproc(Shell shell,Command c) throws CoreException {
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  shell=shell.clone();
  try {
    shell.getEnv().setStdout(out);
    shell.getEnv().setStdin(new NullInputStream());
    shell.exec(c);
    return out.toString().trim();
  }
  finally {
    shell.close();
  }
}
Program: 42355
Project: 42355
Buggy source:
private XdmValue parseXCmd(Shell shell,Command cmd) throws IOException, CoreException {
  ShellThread sht=null;
  try {
    PipedStream pipe=new PipedStream("String_Node_Str");
    shell=shell.clone();
    shell.getEnv().setStdout(pipe.getOutput());
    shell.getEnv().setStdin(new NullInputStream(),"String_Node_Str");
    sht=new ShellThread(shell,null,cmd);
    sht.start();
    DocumentBuilder builder=Shell.getProcessor().newDocumentBuilder();
    XdmNode node=builder.build(pipe.getInput().asSource());
    if (sht != null)     sht.join();
    return node;
  }
 catch (  Exception e) {
    throw new XMLException("String_Node_Str" + cmd,e);
  }
}

Fixed version (ground truth):
private XdmValue parseXCmd(Shell shell,Command cmd) throws IOException, CoreException {
  ShellThread sht=null;
  try {
    PipedStream pipe=new PipedStream();
    shell=shell.clone();
    shell.getEnv().setStdout(pipe.getOutput());
    shell.getEnv().setStdin(new NullInputStream());
    sht=new ShellThread(shell,null,cmd);
    sht.start();
    DocumentBuilder builder=Shell.getProcessor().newDocumentBuilder();
    XdmNode node=builder.build(pipe.getInput().asSource());
    if (sht != null)     sht.join();
    return node;
  }
 catch (  Exception e) {
    throw new XMLException("String_Node_Str" + cmd,e);
  }
}
Program: 42356
Project: 42356
Buggy source:
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  if (mPrefix.equals("String_Node_Str")) {
    Shell sh=shell.clone();
    PipedStream pipe=PipedStream.getPipes(1)[0];
    try {
      sh.getEnv().setStdout(pipe.getOutput());
      sh.getEnv().setStdin(new NullInputStream(),"String_Node_Str");
      ShellThread sht=new ShellThread(sh,null,mCommand);
      env.setStdin(pipe.getInput());
      sht.start();
      return;
    }
  finally {
    }
  }
 else   throw new InvalidArgumentException("String_Node_Str" + mPrefix);
}

Fixed version (ground truth):
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  if (mPrefix.equals("String_Node_Str")) {
    Shell sh=shell.clone();
    PipedStream pipe=PipedStream.getPipes(1)[0];
    try {
      sh.getEnv().setStdout(pipe.getOutput());
      sh.getEnv().setStdin(new NullInputStream());
      ShellThread sht=new ShellThread(sh,null,mCommand);
      env.setStdin(pipe.getInput());
      sht.start();
      return;
    }
  finally {
    }
  }
 else   throw new InvalidArgumentException("String_Node_Str" + mPrefix);
}
Program: 42357
Project: 42357
Buggy source:
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  String file=mFile.expandString(shell,false);
  boolean isPort=file.startsWith("String_Node_Str") && file.endsWith("String_Node_Str");
  if (isPort) {
    String var=file.substring(1,file.length() - 1);
    if (mPrefix.equals("String_Node_Str"))     env.setStdin(env.getVar(var));
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=new XVariable(var,null);
      env.setVar(xvar);
      env.setStdout(xvar);
    }
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=env.getVar(var);
      if (var == null) {
        xvar=new XVariable(var,null);
        env.setVar(xvar);
      }
      env.setStdout(xvar);
    }
    return;
  }
  if (mPrefix.equals("String_Node_Str"))   env.setStdin(shell.getInputStream(file),file);
 else   if (mPrefix.equals("String_Node_Str"))   env.setStderr(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,true));
}

Fixed version (ground truth):
public void exec(Shell shell) throws IOException, CoreException {
  XEnvironment env=shell.getEnv();
  String file=mFile.expandString(shell,false);
  boolean isPort=file.startsWith("String_Node_Str") && file.endsWith("String_Node_Str");
  if (isPort) {
    String var=file.substring(1,file.length() - 1);
    if (mPrefix.equals("String_Node_Str"))     env.setStdin(env.getVar(var));
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=new XVariable(var,null);
      env.setVar(xvar);
      env.setStdout(xvar);
    }
 else     if (mPrefix.equals("String_Node_Str")) {
      XVariable xvar=env.getVar(var);
      if (var == null) {
        xvar=new XVariable(var,null);
        env.setVar(xvar);
      }
      env.setStdout(xvar);
    }
    return;
  }
  if (mPrefix.equals("String_Node_Str")) {
    env.setStdin(shell.getInputStream(file));
    env.getStdin().setSystemId(file);
  }
 else   if (mPrefix.equals("String_Node_Str"))   env.setStderr(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,false));
 else   if (mPrefix.equals("String_Node_Str"))   env.setStdout(shell.getOutputStream(file,true));
}
Program: 42358
Project: 42358
Buggy source:
public void exec(Shell shell) throws CoreException, UnsupportedEncodingException {
  shell.getEnv().setStdin(new ByteArrayInputStream(mHere.getBytes(Shell.getTextEncoding())),"String_Node_Str");
}

Fixed version (ground truth):
public void exec(Shell shell) throws CoreException, UnsupportedEncodingException {
  shell.getEnv().setStdin(new ByteArrayInputStream(mHere.getBytes(Shell.getTextEncoding())));
}
Program: 42359
Project: 42359
Buggy source:
private XdmValue parseXExpr(String arg){
  Processor processor=Shell.getProcessor();
  XQueryCompiler compiler=processor.newXQueryCompiler();
  NameValueMap<String> ns=mShell.getEnv().getNamespaces();
  if (ns != null) {
    for (    String prefix : ns.keySet()) {
      String uri=ns.get(prefix);
      compiler.declareNamespace(prefix,uri);
    }
  }
  XQueryExecutable expr=null;
  StringBuffer sb=new StringBuffer();
  Collection<XVariable> vars=mShell.getEnv().getVars().values();
  for (  XVariable value : vars) {
    if (value.getFlags().contains(XVarFlag.XEXPR))     sb.append("String_Node_Str").append(value.getName()).append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append(arg);
  try {
    expr=compiler.compile(sb.toString());
    XQueryEvaluator eval=expr.load();
    for (    XVariable value : vars) {
      if (value.getFlags().contains(XVarFlag.XEXPR))       eval.setExternalVariable(new QName(value.getName()),value.getValue().asXdmValue());
    }
    eval.setExternalVariable(new QName("String_Node_Str"),new XValue(mShell.getArgs()).asXdmValue());
    return eval.evaluate();
  }
 catch (  SaxonApiException e) {
    mLogger.warn("String_Node_Str" + arg,e);
    mShell.printErr("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
private XdmValue parseXExpr(String arg){
  Processor processor=Shell.getProcessor();
  XQueryCompiler compiler=processor.newXQueryCompiler();
  NameValueMap<String> ns=mShell.getEnv().getNamespaces();
  if (ns != null) {
    for (    String prefix : ns.keySet()) {
      String uri=ns.get(prefix);
      compiler.declareNamespace(prefix,uri);
    }
  }
  XQueryExecutable expr=null;
  StringBuffer sb=new StringBuffer();
  Collection<XVariable> vars=mShell.getEnv().getVars().values();
  for (  XVariable value : vars) {
    if (!value.isNull() && value.getFlags().contains(XVarFlag.XEXPR))     sb.append("String_Node_Str").append(value.getName()).append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append(arg);
  try {
    expr=compiler.compile(sb.toString());
    XQueryEvaluator eval=expr.load();
    for (    XVariable value : vars) {
      if (!value.isNull() && value.getFlags().contains(XVarFlag.XEXPR))       eval.setExternalVariable(new QName(value.getName()),value.getValue().asXdmValue());
    }
    eval.setExternalVariable(new QName("String_Node_Str"),new XValue(mShell.getArgs()).asXdmValue());
    return eval.evaluate();
  }
 catch (  SaxonApiException e) {
    mLogger.warn("String_Node_Str" + arg,e);
    mShell.printErr("String_Node_Str");
  }
  return null;
}
Program: 42360
Project: 42360
Buggy source:
private List<XValue> expandWild(XValue v){
  ArrayList<XValue> r=new ArrayList<XValue>();
  if (v.isXExpr()) {
    r.add(v);
    return r;
  }
  String vs=v.toString();
  int vslen=vs.length();
  StringBuffer sb=new StringBuffer();
  char cQuote=0;
  boolean wildUnQuoted=false;
  for (int i=0; i < vslen; i++) {
    char c=vs.charAt(i);
    if (c == '"' || c == '\'') {
      if (c == cQuote) {
        cQuote=0;
        continue;
      }
 else       if (cQuote == 0) {
        cQuote=c;
        continue;
      }
    }
    if (cQuote == 0 && (c == '*' || c == '?' || c == '['))     wildUnQuoted=true;
    sb.append(c);
  }
  if (!wildUnQuoted) {
    r.add(new XValue(sb.toString()));
    return r;
  }
  vs=sb.toString();
  List<String> rs=new ArrayList<String>();
  String wilds[]=vs.split("String_Node_Str");
  expandDir(mShell.getCurdir(),null,wilds,rs);
  for (  String f : rs) {
    r.add(new XValue(f));
  }
  if (r.size() == 0)   r.add(v);
  return r;
}

Fixed version (ground truth):
private List<XValue> expandWild(XValue v){
  ArrayList<XValue> r=new ArrayList<XValue>();
  if (v.isXExpr()) {
    r.add(v);
    return r;
  }
  String vs=v.toString();
  int vslen=vs.length();
  StringBuffer sb=new StringBuffer();
  char cQuote=0;
  boolean wildUnQuoted=false;
  for (int i=0; i < vslen; i++) {
    char c=vs.charAt(i);
    if (c == '\\' && i < vslen) {
      c=vs.charAt(++i);
      sb.append(c);
      continue;
    }
    if (c == '"' || c == '\'') {
      if (c == cQuote) {
        cQuote=0;
        continue;
      }
 else       if (cQuote == 0) {
        cQuote=c;
        continue;
      }
    }
    if (cQuote == 0 && (c == '*' || c == '?' || c == '['))     wildUnQuoted=true;
    sb.append(c);
  }
  if (!wildUnQuoted) {
    r.add(new XValue(sb.toString()));
    return r;
  }
  vs=sb.toString();
  List<String> rs=new ArrayList<String>();
  String wilds[]=vs.split("String_Node_Str");
  expandDir(mShell.getCurdir(),null,wilds,rs);
  for (  String f : rs) {
    r.add(new XValue(f));
  }
  if (r.size() == 0)   r.add(v);
  return r;
}
Program: 42362
Project: 42362
Buggy source:
private void setGlobalVars(){
  String path=System.getenv("String_Node_Str");
  getEnv().setVar(new XVariable("String_Node_Str",new XValue(path)));
  getEnv().setVar(new XDynamicVariable("String_Node_Str",EnumSet.of(XVarFlag.READONLY,XVarFlag.XEXPR)){
    public XValue getValue(){
      return new XValue(Util.toJavaPath(getEnv().getCurdir().getAbsolutePath()));
    }
  }
);
  getEnv().setVar("String_Node_Str",System.getProperty("String_Node_Str"));
}

Fixed version (ground truth):
private void setGlobalVars(){
  String path=Util.toJavaPath(System.getenv("String_Node_Str"));
  getEnv().setVar(new XVariable("String_Node_Str",new XValue(path)));
  getEnv().setVar(new XDynamicVariable("String_Node_Str",EnumSet.of(XVarFlag.READONLY,XVarFlag.XEXPR)){
    public XValue getValue(){
      return new XValue(Util.toJavaPath(getEnv().getCurdir().getAbsolutePath()));
    }
  }
);
  getEnv().setVar("String_Node_Str",Util.toJavaPath(System.getProperty("String_Node_Str")));
}
Program: 42364
Project: 42364
Buggy source:
private XdmValue parseXExpr(String arg){
  Processor processor=Shell.getProcessor();
  XQueryCompiler compiler=processor.newXQueryCompiler();
  NameValueMap<String> ns=mShell.getEnv().getNamespaces();
  if (ns != null) {
    for (    String prefix : ns.keySet()) {
      String uri=ns.get(prefix);
      compiler.declareNamespace(prefix,uri);
    }
  }
  XQueryExecutable expr=null;
  StringBuffer sb=new StringBuffer();
  Collection<XVariable> vars=mShell.getEnv().getVars().values();
  for (  XVariable value : vars) {
    if (value.getFlags().contains(XVarFlag.EXPORT))     sb.append("String_Node_Str").append(value.getName()).append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append(arg);
  try {
    expr=compiler.compile(sb.toString());
    XQueryEvaluator eval=expr.load();
    for (    XVariable value : vars) {
      if (value.getFlags().contains(XVarFlag.EXPORT))       eval.setExternalVariable(new QName(value.getName()),value.getValue().asXdmValue());
    }
    eval.setExternalVariable(new QName("String_Node_Str"),new XValue(mShell.getArgs()).asXdmValue());
    return eval.evaluate();
  }
 catch (  SaxonApiException e) {
    mLogger.warn("String_Node_Str" + arg,e);
    mShell.printErr("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
private XdmValue parseXExpr(String arg){
  Processor processor=Shell.getProcessor();
  XQueryCompiler compiler=processor.newXQueryCompiler();
  NameValueMap<String> ns=mShell.getEnv().getNamespaces();
  if (ns != null) {
    for (    String prefix : ns.keySet()) {
      String uri=ns.get(prefix);
      compiler.declareNamespace(prefix,uri);
    }
  }
  XQueryExecutable expr=null;
  StringBuffer sb=new StringBuffer();
  Collection<XVariable> vars=mShell.getEnv().getVars().values();
  for (  XVariable value : vars) {
    if (value.getFlags().contains(XVarFlag.XEXPR))     sb.append("String_Node_Str").append(value.getName()).append("String_Node_Str");
  }
  sb.append("String_Node_Str");
  sb.append(arg);
  try {
    expr=compiler.compile(sb.toString());
    XQueryEvaluator eval=expr.load();
    for (    XVariable value : vars) {
      if (value.getFlags().contains(XVarFlag.XEXPR))       eval.setExternalVariable(new QName(value.getName()),value.getValue().asXdmValue());
    }
    eval.setExternalVariable(new QName("String_Node_Str"),new XValue(mShell.getArgs()).asXdmValue());
    return eval.evaluate();
  }
 catch (  SaxonApiException e) {
    mLogger.warn("String_Node_Str" + arg,e);
    mShell.printErr("String_Node_Str");
  }
  return null;
}
Program: 42365
Project: 42365
Buggy source:
private void setGlobalVars(){
  Map<String,String> env=System.getenv();
  for (  Map.Entry<String,String> entry : env.entrySet()) {
    String name=entry.getKey();
    if (name.equals("String_Node_Str"))     continue;
    getEnv().setVar(new XVariable(name,new XValue(entry.getValue()),EnumSet.of(XVarFlag.EXPORT)));
  }
  String path=Util.toJavaPath(System.getenv("String_Node_Str"));
  getEnv().setVar(new XVariable("String_Node_Str",new XValue(path)));
  getEnv().setVar(new XDynamicVariable("String_Node_Str",EnumSet.of(XVarFlag.READONLY,XVarFlag.XEXPR)){
    public XValue getValue(){
      return new XValue(Util.toJavaPath(getEnv().getCurdir().getAbsolutePath()));
    }
  }
);
  getEnv().setVar("String_Node_Str",Util.toJavaPath(System.getProperty("String_Node_Str")));
}

Fixed version (ground truth):
private void setGlobalVars(){
  Map<String,String> env=System.getenv();
  for (  Map.Entry<String,String> entry : env.entrySet()) {
    String name=entry.getKey();
    if (name.equals("String_Node_Str"))     continue;
    if (Util.isBlank(name))     continue;
    if (!name.matches("String_Node_Str"))     continue;
    getEnv().setVar(new XVariable(name,new XValue(entry.getValue()),EnumSet.of(XVarFlag.EXPORT)));
  }
  String path=Util.toJavaPath(System.getenv("String_Node_Str"));
  getEnv().setVar(new XVariable("String_Node_Str",new XValue(path)));
  getEnv().setVar(new XDynamicVariable("String_Node_Str",EnumSet.of(XVarFlag.READONLY,XVarFlag.XEXPR)){
    public XValue getValue(){
      return new XValue(Util.toJavaPath(getEnv().getCurdir().getAbsolutePath()));
    }
  }
);
  getEnv().setVar("String_Node_Str",Util.toJavaPath(System.getProperty("String_Node_Str")));
}
Program: 42366
Project: 42366
Buggy source:
public OutputStream getStdout(){
  if (mStdout == null)   mStdout=new SynchronizedOutputStream(System.out);
  return mStdout;
}

Fixed version (ground truth):
/** 
 * @return
 * @see org.xmlsh.core.XIOEnvironment#getStdout()
 */
public OutputStream getStdout(){
  return mIO.getStdout();
}
Program: 42367
Project: 42367
Buggy source:
public boolean isStdinRedirected(){
  return mStdinRedirected;
}

Fixed version (ground truth):
public boolean isStdinRedirected(){
  return mIO.isStdinRedirected();
}
Program: 42368
Project: 42368
Buggy source:
/** 
 * @param stdin the stdin to set
 * @throws IOException 
 */
public void setStdin(InputStream stdin) throws IOException {
  mStdinRedirected=true;
  if (mStdin != null)   mStdin.close();
  mStdin=new SynchronizedInputStream(stdin);
}

Fixed version (ground truth):
/** 
 * @param stdin
 * @throws IOException
 * @see org.xmlsh.core.XIOEnvironment#setStdin(java.io.InputStream)
 */
public void setStdin(InputStream stdin) throws IOException {
  mIO.setStdin(stdin);
}
Program: 42369
Project: 42369
Buggy source:
/** 
 * @param stdout the stdout to set
 * @throws IOException 
 */
public void setStdout(OutputStream stdout) throws IOException {
  if (mStdout != null)   mStdout.close();
  mStdout=new SynchronizedOutputStream(stdout);
}

Fixed version (ground truth):
/** 
 * @param stdout
 * @throws IOException
 * @see org.xmlsh.core.XIOEnvironment#setStdout(java.io.OutputStream)
 */
public void setStdout(OutputStream stdout) throws IOException {
  mIO.setStdout(stdout);
}
Program: 42370
Project: 42370
Buggy source:
public XEnvironment clone(Shell shell){
  XEnvironment that=new XEnvironment(shell);
  that.mVars.putAll(this.mVars);
  that.mStderr=this.mStderr;
  if (that.mStderr != null)   that.mStderr.addRef();
  that.mStdin=this.mStdin;
  if (that.mStdin != null) {
    that.mStdin.addRef();
    that.mStdinRedirected=this.mStdinRedirected;
  }
  that.mStdout=this.mStdout;
  if (that.mStdout != null)   that.mStdout.addRef();
  return that;
}

Fixed version (ground truth):
public XEnvironment clone(Shell shell){
  XEnvironment that=new XEnvironment(shell);
  that.mVars.putAll(this.mVars);
  that.mIO=mIO.clone();
  return that;
}
Program: 42371
Project: 42371
Buggy source:
public InputStream getStdin(){
  if (mStdin == null)   mStdin=new SynchronizedInputStream(System.in);
  return mStdin;
}

Fixed version (ground truth):
/** 
 * @return
 * @see org.xmlsh.core.XIOEnvironment#getStdin()
 */
public InputStream getStdin(){
  return mIO.getStdin();
}
Program: 42372
Project: 42372
Buggy source:
public void close(){
  try {
    if (this.mStdout != null)     this.mStdout.close();
    if (this.mStderr != null)     this.mStderr.close();
    if (this.mStdin != null)     this.mStdin.close();
    this.mStderr=null;
    this.mStdout=null;
    this.mStdin=null;
  }
 catch (  IOException e) {
    mLogger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void close(){
  mIO.close();
}
Program: 42373
Project: 42373
Buggy source:
public OutputStream getStderr(){
  if (mStderr == null)   mStderr=new SynchronizedOutputStream(System.err);
  return mStderr;
}

Fixed version (ground truth):
/** 
 * @return
 * @see org.xmlsh.core.XIOEnvironment#getStderr()
 */
public OutputStream getStderr(){
  return mIO.getStderr();
}
Program: 42374
Project: 42374
Buggy source:
/** 
 * @param stderr the stderr to set
 * @throws IOException 
 */
public void setStderr(OutputStream stderr) throws IOException {
  if (mStderr != null)   mStderr.close();
  mStderr=new SynchronizedOutputStream(stderr);
}

Fixed version (ground truth):
/** 
 * @param stderr
 * @throws IOException
 * @see org.xmlsh.core.XIOEnvironment#setStderr(java.io.OutputStream)
 */
public void setStderr(OutputStream stderr) throws IOException {
  mIO.setStderr(stderr);
}
Program: 42375
Project: 42375
Buggy source:
@Override public int exec(Shell shell) throws Exception {
  applyRedirect(shell);
  return shell.exec(mCommand);
}

Fixed version (ground truth):
@Override public int exec(Shell shell) throws Exception {
  XIOEnvironment io=shell.getEnv().saveIO();
  try {
    applyRedirect(shell);
    return shell.exec(mCommand);
  }
  finally {
    shell.getEnv().restoreIO(io);
  }
}
Program: 42376
Project: 42376
Buggy source:
@Override public int exec(Shell shell) throws Exception {
  XValue wordv=shell.expandString(mWord);
  String word=wordv.toString();
  for (  CaseItem item : mList) {
    if (item.matches(word)) {
      return item.exec(shell);
    }
  }
  return 1;
}

Fixed version (ground truth):
@Override public int exec(Shell shell) throws Exception {
  XIOEnvironment io=shell.getEnv().saveIO();
  try {
    applyRedirect(shell);
    XValue wordv=shell.expandString(mWord);
    String word=wordv.toString();
    for (    CaseItem item : mList) {
      if (item.matches(word)) {
        return item.exec(shell);
      }
    }
    return 1;
  }
  finally {
    shell.getEnv().restoreIO(io);
  }
}
Program: 42377
Project: 42377
Buggy source:
public int exec(Shell shell) throws Exception {
  if (!mName.matches("String_Node_Str")) {
    shell.printErr("String_Node_Str" + mName);
    return 1;
  }
  shell.pushEnv();
  try {
    applyRedirect(shell);
    if (mWords == null) {
      for (      XValue inword : shell.getArgs()) {
        shell.getEnv().setVar(new XVariable(mName,inword));
        shell.exec(mCommand);
      }
    }
 else     for (    String in : mWords) {
      List<XValue> inList=shell.expand(in,true);
      for (      XValue inword : inList) {
        if (!shell.keepRunning())         break;
        shell.getEnv().setVar(new XVariable(mName,inword));
        shell.exec(mCommand);
      }
      if (!shell.keepRunning())       break;
    }
  }
  finally {
    shell.popEnv();
  }
  return 0;
}

Fixed version (ground truth):
public int exec(Shell shell) throws Exception {
  if (!mName.matches("String_Node_Str")) {
    shell.printErr("String_Node_Str" + mName);
    return 1;
  }
  XIOEnvironment io=shell.getEnv().saveIO();
  try {
    applyRedirect(shell);
    if (mWords == null) {
      for (      XValue inword : shell.getArgs()) {
        shell.getEnv().setVar(new XVariable(mName,inword));
        shell.exec(mCommand);
      }
    }
 else     for (    String in : mWords) {
      List<XValue> inList=shell.expand(in,true);
      for (      XValue inword : inList) {
        if (!shell.keepRunning())         break;
        shell.getEnv().setVar(new XVariable(mName,inword));
        shell.exec(mCommand);
      }
      if (!shell.keepRunning())       break;
    }
  }
  finally {
    shell.getEnv().restoreIO(io);
  }
  return 0;
}
Program: 42378
Project: 42378
Buggy source:
public int exec(Shell shell) throws Exception {
  int ret=shell.exec(mIfPart);
  if (ret == 0 && shell.keepRunning())   ret=shell.exec(mThenPart);
 else   if (mElsePart != null && shell.keepRunning())   ret=shell.exec(mElsePart);
  return ret;
}

Fixed version (ground truth):
public int exec(Shell shell) throws Exception {
  XIOEnvironment io=shell.getEnv().saveIO();
  try {
    applyRedirect(shell);
    int ret=shell.exec(mIfPart);
    if (ret == 0 && shell.keepRunning())     ret=shell.exec(mThenPart);
 else     if (mElsePart != null && shell.keepRunning())     ret=shell.exec(mElsePart);
    return ret;
  }
  finally {
    shell.getEnv().restoreIO(io);
  }
}
Program: 42379
Project: 42379
Buggy source:
public int exec(Shell shell) throws Exception {
  shell.pushEnv();
  try {
    while (!shell.toBool(shell.exec(mUntil)) && shell.keepRunning()) {
      shell.exec(mDo);
    }
  }
  finally {
    shell.popEnv();
  }
  return 0;
}

Fixed version (ground truth):
public int exec(Shell shell) throws Exception {
  XIOEnvironment io=shell.getEnv().saveIO();
  try {
    applyRedirect(shell);
    while (!shell.toBool(shell.exec(mUntil)) && shell.keepRunning()) {
      shell.exec(mDo);
    }
  }
  finally {
    shell.getEnv().restoreIO(io);
  }
  return 0;
}
Program: 42380
Project: 42380
Buggy source:
/** 
 * @param stdin the stdin to set
 */
public void setStdin(InputStream stdin){
  mStdinRedirected=true;
  mStdin=new SynchronizedInputStream(stdin);
}

Fixed version (ground truth):
/** 
 * @param stdin the stdin to set
 * @throws IOException 
 */
public void setStdin(InputStream stdin) throws IOException {
  mStdinRedirected=true;
  if (mStdin != null)   mStdin.close();
  mStdin=new SynchronizedInputStream(stdin);
}
Program: 42381
Project: 42381
Buggy source:
/** 
 * @param stdout the stdout to set
 */
public void setStdout(OutputStream stdout){
  mStdout=new SynchronizedOutputStream(stdout);
}

Fixed version (ground truth):
/** 
 * @param stdout the stdout to set
 * @throws IOException 
 */
public void setStdout(OutputStream stdout) throws IOException {
  if (mStdout != null)   mStdout.close();
  mStdout=new SynchronizedOutputStream(stdout);
}
Program: 42382
Project: 42382
Buggy source:
/** 
 * @param stderr the stderr to set
 */
public void setStderr(OutputStream stderr){
  mStderr=new SynchronizedOutputStream(stderr);
}

Fixed version (ground truth):
/** 
 * @param stderr the stderr to set
 * @throws IOException 
 */
public void setStderr(OutputStream stderr) throws IOException {
  if (mStderr != null)   mStderr.close();
  mStderr=new SynchronizedOutputStream(stderr);
}
Program: 42383
Project: 42383
Buggy source:
public void exec(Shell shell){
  for (  Assign ass : mList) {
    XValue value=shell.expandString(ass.mValue);
    shell.getEnv().setVar(new XVariable(ass.mVariable,value));
  }
}

Fixed version (ground truth):
public void exec(Shell shell) throws IOException {
  for (  Assign ass : mList) {
    XValue value=shell.expandString(ass.mValue);
    shell.getEnv().setVar(new XVariable(ass.mVariable,value));
  }
}
Program: 42384
Project: 42384
Buggy source:
public List<XValue> toCmdLine(Shell shell,String command){
  ArrayList<XValue> args=new ArrayList<XValue>();
  args.addAll(shell.expand(command,false));
  for (  String arg : mArgs)   args.addAll(shell.expand(arg,false));
  return args;
}

Fixed version (ground truth):
public List<XValue> toCmdLine(Shell shell,String command) throws IOException {
  ArrayList<XValue> args=new ArrayList<XValue>();
  args.addAll(shell.expand(command,false));
  for (  String arg : mArgs)   args.addAll(shell.expand(arg,false));
  return args;
}
Program: 42385
Project: 42385
Buggy source:
public void exec(Shell shell) throws UnsupportedEncodingException {
  shell.getEnv().setStdin(new ByteArrayInputStream(mHere.getBytes("String_Node_Str")));
}

Fixed version (ground truth):
public void exec(Shell shell) throws IOException {
  shell.getEnv().setStdin(new ByteArrayInputStream(mHere.getBytes("String_Node_Str")));
}
Program: 42386
Project: 42386
Buggy source:
private String runCmd(String cmd){
  InputStream script=new StringBufferInputStream(cmd);
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  Shell shell=mShell.clone();
  try {
    shell.getEnv().setStdout(out);
    shell.getEnv().setStdin(new NullInputStream());
    shell.runScript(script);
    return out.toString();
  }
 catch (  ParseException e) {
    shell.printErr(e.getMessage());
    return "String_Node_Str";
  }
 finally {
    shell.close();
    try {
      script.close();
    }
 catch (    IOException e) {
      mLogger.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private String runCmd(String cmd) throws IOException {
  InputStream script=new StringBufferInputStream(cmd);
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  Shell shell=mShell.clone();
  try {
    shell.getEnv().setStdout(out);
    shell.getEnv().setStdin(new NullInputStream());
    shell.runScript(script);
    return out.toString();
  }
 catch (  ParseException e) {
    shell.printErr(e.getMessage());
    return "String_Node_Str";
  }
 finally {
    shell.close();
    try {
      script.close();
    }
 catch (    IOException e) {
      mLogger.error("String_Node_Str",e);
    }
  }
}
Program: 42388
Project: 42388
Buggy source:
public XValue expandString(String value){
  List<XValue> ret=expand(value,false);
  if (ret.size() == 0)   return new XValue();
 else   if (ret.size() == 1)   return ret.get(0);
  StringBuffer sb=new StringBuffer();
  for (  XValue v : ret) {
    if (sb.length() > 0)     sb.append(' ');
    sb.append(v.toString());
  }
  return new XValue(sb.toString());
}

Fixed version (ground truth):
public XValue expandString(String value) throws IOException {
  List<XValue> ret=expand(value,false);
  if (ret.size() == 0)   return new XValue();
 else   if (ret.size() == 1)   return ret.get(0);
  StringBuffer sb=new StringBuffer();
  for (  XValue v : ret) {
    if (sb.length() > 0)     sb.append(' ');
    sb.append(v.toString());
  }
  return new XValue(sb.toString());
}
Program: 42389
Project: 42389
Buggy source:
public List<XValue> expand(String s,boolean bExpandSequences){
  Expander e=new Expander(this);
  List<XValue> result=e.expand(s);
  if (bExpandSequences)   result=Util.expandSequences(result);
  return result;
}

Fixed version (ground truth):
public List<XValue> expand(String s,boolean bExpandSequences) throws IOException {
  Expander e=new Expander(this);
  List<XValue> result=e.expand(s);
  if (bExpandSequences)   result=Util.expandSequences(result);
  return result;
}
Program: 42390
Project: 42390
Buggy source:
private File getFile(String str) throws Error {
  try {
    return mShell.getFile(str);
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str" + str);
  }
}

Fixed version (ground truth):
private File getFile(String str) throws Error {
  try {
    return mShell.getFile(str).getCanonicalFile();
  }
 catch (  IOException e) {
    throw new Error("String_Node_Str" + str);
  }
}
Program: 42391
Project: 42391
Buggy source:
public int run(Shell shell,String cmd,XValue[] args) throws Exception {
  String sdir=null;
  if (args.length < 1) {
    String home=shell.getEnv().getVar("String_Node_Str").toString();
    if (home == null) {
      shell.printErr("String_Node_Str");
      return 1;
    }
    sdir=home;
  }
 else   sdir=args[0].toString();
  File newDir=shell.getFile(sdir).getCanonicalFile();
  if (newDir.exists() && newDir.isDirectory() && newDir.canRead()) {
    shell.setCurdir(newDir);
    return 0;
  }
 else {
    shell.printErr("String_Node_Str" + sdir);
    return 1;
  }
}

Fixed version (ground truth):
public int run(Shell shell,String cmd,XValue[] args) throws Exception {
  String sdir=null;
  if (args.length < 1) {
    String home=shell.getEnv().getVar("String_Node_Str").toString();
    if (home == null) {
      shell.printErr("String_Node_Str");
      return 1;
    }
    sdir=home;
  }
 else   sdir=args[0].toString();
  File newDir=shell.getFile(sdir);
  if (newDir.exists() && newDir.isDirectory() && newDir.canRead()) {
    shell.setCurdir(newDir);
    return 0;
  }
 else {
    shell.printErr("String_Node_Str" + sdir);
    return 1;
  }
}
Program: 42392
Project: 42392
Buggy source:
public File getExplicitFile(String name,boolean mustExist){
  File file=null;
  if (name.startsWith("String_Node_Str"))   file=new File(name);
 else   file=new File(getCurdir(),name);
  if (file == null)   return null;
  if (mustExist && !file.exists())   return null;
  return file;
}

Fixed version (ground truth):
public File getExplicitFile(String name,boolean mustExist){
  File file=new File(name).getAbsoluteFile();
  if (mustExist && !file.exists())   return null;
  return file;
}
Program: 42393
Project: 42393
Buggy source:
public static <T extends Event>InputMap<T> when(BooleanSupplier condition,InputMap<T> im){
  return new InputMap<T>(){
    @Override public void forEachEventType(    HandlerConsumer<? super T> f){
      HandlerConsumer<T> g=new HandlerConsumer<T>(){
        @Override public <F extends T>void accept(        EventType<? extends F> t,        InputHandler<? super F> h){
          f.accept(t,evt -> condition.getAsBoolean() ? h.process(evt) : Result.PROCEED);
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
public static <T extends Event>InputMap<T> when(BooleanSupplier condition,InputMap<T> im){
  return new InputMap<T>(){
    @Override public void forEachEventType(    HandlerConsumer<? super T> f){
      HandlerConsumer<T> g=new HandlerConsumer<T>(){
        @Override public <F extends T>void accept(        EventType<? extends F> t,        InputHandler<? super F> h){
          f.accept(t,evt -> condition.getAsBoolean() ? h.process(evt) : Result.PROCEED);
        }
      }
;
      im.forEachEventType(g);
    }
  }
;
}
Program: 42394
Project: 42394
Buggy source:
protected ThroughputBenchmark(final int timeInMinute,final int concurrency,final int SQLType){
  super();
  this.timeInMillis=timeInMinute * 60 * 1000L;
  this.concurrency=concurrency;
  this.SQLType=SQLType;
  this.completeQueryCount=0L;
  this.totalCostTime=0D;
}

Fixed version (ground truth):
protected ThroughputBenchmark(final int timeInMinute,final int concurrency,final int SQLType){
  super();
  this.timeInMillis=timeInMinute * 60 * 1000L;
  this.concurrency=concurrency;
  this.SQLType=SQLType;
  this.completeQueryCount=0L;
}
Program: 42395
Project: 42395
Buggy source:
@Override public final void executeBenchmark() throws SQLException {
  final Thread[] executors=new Thread[this.concurrency];
  for (int index=0; index < this.concurrency; index++) {
    executors[index]=new Thread(this.getExecutableTask());
  }
  this.aliveExecutorCount=this.concurrency;
  for (int index=0; index < this.concurrency; index++) {
    executors[index].start();
  }
  for (; ; ) {
    if (this.aliveExecutorCount == 0) {
      break;
    }
    try {
      Thread.sleep(1000L);
    }
 catch (    InterruptedException e) {
    }
  }
  LOG.info(this.getClass().getSimpleName() + "String_Node_Str" + this.completeQueryCount / (this.timeInMillis / 1000.0D));
  LOG.info(this.getClass().getSimpleName() + "String_Node_Str" + this.totalCostTime / this.completeQueryCount);
}

Fixed version (ground truth):
@Override public final void executeBenchmark() throws SQLException {
  final Thread[] executors=new Thread[this.concurrency];
  for (int index=0; index < this.concurrency; index++) {
    executors[index]=new Thread(this.getExecutableTask());
  }
  this.aliveExecutorCount=this.concurrency;
  for (int index=0; index < this.concurrency; index++) {
    executors[index].start();
  }
  for (; ; ) {
    if (this.aliveExecutorCount == 0) {
      break;
    }
    try {
      Thread.sleep(1000L);
    }
 catch (    InterruptedException e) {
    }
  }
  LOG.info(this.getClass().getSimpleName() + "String_Node_Str" + this.completeQueryCount / (this.timeInMillis / 1000.0D));
}