nus-yam/ex-repair huggingface dataset:
Program: 42251
Project: 42251
Buggy source:
@Override public void initZygote(StartupParam startupParam) throws Throwable {
  mSettingHelper=SettingHelper.getInstance(new XSharedPreferences(Constant.PKG_NAME,SettingHelper.PREF));
  XposedBridge.hookAllConstructors(Activity.class,new XC_MethodHook(){
    @Override protected void afterHookedMethod(    MethodHookParam param) throws Throwable {
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",null);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
    }
  }
);
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",Bundle.class,new ActivityOnCreateHook());
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",new ActivityOnResumeHook(mSettingHelper));
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",boolean.class,new OnWindowFocusedHook(mSettingHelper));
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",new OnContentChangedHook());
}

Fixed version (ground truth):
@Override public void initZygote(StartupParam startupParam) throws Throwable {
  mSettingHelper=new SettingHelper(new XSharedPreferences(Constant.PKG_NAME,SettingHelper.PREF));
  XposedBridge.hookAllConstructors(Activity.class,new XC_MethodHook(){
    @Override protected void afterHookedMethod(    MethodHookParam param) throws Throwable {
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",null);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
      XposedHelpers.setAdditionalInstanceField(param.thisObject,"String_Node_Str",false);
    }
  }
);
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",Bundle.class,new ActivityOnCreateHook());
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",new ActivityOnResumeHook(mSettingHelper));
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",boolean.class,new OnWindowFocusedHook(mSettingHelper));
  XposedHelpers.findAndHookMethod(Activity.class,"String_Node_Str",new OnContentChangedHook());
}
Program: 42252
Project: 42252
Buggy source:
private SettingHelper(XSharedPreferences xprefs){
  mXPreferences=xprefs;
}

Fixed version (ground truth):
private SettingHelper(SharedPreferences prefs){
  mPreferences=prefs;
}
Program: 42253
Project: 42253
Buggy source:
public static SettingHelper getInstance(XSharedPreferences xprefs){
  if (mInstance == null) {
    mInstance=new SettingHelper(xprefs);
  }
  return mInstance;
}

Fixed version (ground truth):
public static SettingHelper getInstance(Context context){
  if (mInstance == null) {
    SharedPreferences sp=context.getSharedPreferences(PREF,Context.MODE_WORLD_READABLE);
    mInstance=new SettingHelper(sp);
  }
  return mInstance;
}
Program: 42254
Project: 42254
Buggy source:
public void writeColor(String pkgName,String actName,int color){
  Editor edit=mXPreferences.edit();
  edit.putInt(getKey(pkgName,actName),color);
  edit.commit();
}

Fixed version (ground truth):
public void writeColor(String pkgName,String actName,int color){
  Editor edit=mPreferences.edit();
  edit.putInt(getKey(pkgName,actName),color);
  edit.commit();
}
Program: 42256
Project: 42256
Buggy source:
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  final Activity activity=(Activity)param.thisObject;
  boolean isSysApp=(Boolean)XposedHelpers.getAdditionalInstanceField(activity,"String_Node_Str");
  if (isSysApp) {
    Utils.log("String_Node_Str");
    return;
  }
  WindowType type=Utils.getWindowType(activity);
  if (type != WindowType.Normal)   return;
  boolean hasProfile=(Boolean)XposedHelpers.getAdditionalInstanceField(activity,"String_Node_Str");
  if (hasProfile)   return;
  int changeTimes=(Integer)XposedHelpers.getAdditionalInstanceField(activity,"String_Node_Str");
  XposedHelpers.setAdditionalInstanceField(activity,"String_Node_Str",changeTimes + 1);
  if (changeTimes == 0) {
    return;
  }
  Utils.log("String_Node_Str" + changeTimes + "String_Node_Str");
  XposedHelpers.setAdditionalInstanceField(activity,"String_Node_Str",null);
  XposedHelpers.setAdditionalInstanceField(activity,"String_Node_Str",true);
  dialog(activity);
}

Fixed version (ground truth):
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  final Activity activity=(Activity)param.thisObject;
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      update(activity);
    }
  }
,100L);
}
Program: 42257
Project: 42257
Buggy source:
public static WindowType getWindowType(Activity activity){
  Intent activityIntent=activity.getIntent();
  int flags=activity.getWindow().getAttributes().flags;
  if ((flags & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) == WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) {
    return WindowType.Translucent;
  }
  if ((flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
    return WindowType.Fullscreen;
  }
  if (activityIntent != null && (activityIntent.getFlags() & 0x00002000) == 0x00002000) {
    return WindowType.Float;
  }
  int isFloating=XposedHelpers.getStaticIntField(XposedHelpers.findClass("String_Node_Str",null),"String_Node_Str");
  if (activity.getWindow().getWindowStyle().getBoolean(isFloating,false)) {
    Utils.log("String_Node_Str");
    return WindowType.Float;
  }
  return WindowType.Normal;
}

Fixed version (ground truth):
public static WindowType getWindowType(Activity activity){
  if (activity.getPackageName().equals("String_Node_Str")) {
    return WindowType.Normal;
  }
  Intent activityIntent=activity.getIntent();
  int flags=activity.getWindow().getAttributes().flags;
  if ((flags & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) == WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) {
    return WindowType.Translucent;
  }
  if ((flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
    return WindowType.Fullscreen;
  }
  if (activityIntent != null && (activityIntent.getFlags() & 0x00002000) == 0x00002000) {
    return WindowType.Float;
  }
  int isFloating=XposedHelpers.getStaticIntField(XposedHelpers.findClass("String_Node_Str",null),"String_Node_Str");
  if (activity.getWindow().getWindowStyle().getBoolean(isFloating,false)) {
    Utils.log("String_Node_Str");
    return WindowType.Float;
  }
  return WindowType.Normal;
}
Program: 42258
Project: 42258
Buggy source:
public void writeColor(String pkgName,String actName,int color){
  Editor edit=mPreferences.edit();
  String r=Integer.toHexString(Color.red(color));
  String g=Integer.toHexString(Color.green(color));
  String b=Integer.toHexString(Color.blue(color));
  edit.putString(r + g + b,null);
  edit.commit();
  Intent intent=new Intent(Constant.INTENT_UPDATE_SETTINGS);
  mContext.sendBroadcast(intent);
}

Fixed version (ground truth):
public void writeColor(String pkgName,String actName,int color){
  Editor edit=mPreferences.edit();
  String r=Integer.toHexString(Color.red(color));
  String g=Integer.toHexString(Color.green(color));
  String b=Integer.toHexString(Color.blue(color));
  edit.putString(actName,r + g + b);
  edit.commit();
  Intent intent=new Intent(Constant.INTENT_UPDATE_SETTINGS);
  mContext.sendBroadcast(intent);
}
Program: 42262
Project: 42262
Buggy source:
public void UnifiedFileAttributes(Path path,BasicFileAttributes attrs,boolean followLinks){
  mPath=path;
  setBasic(attrs);
  setPosix(FileUtils.getPosixFileAttributes(path,followLinks));
  setDos(FileUtils.getDosFileAttributes(path,followLinks));
  if (getPosix() != null) {
    if (getBasic() != null)     setBasic(getPosix());
    posixPermissions=getPosix().permissions();
  }
 else   if (getBasic() == null) {
    if (getDos() != null)     setBasic(getDos());
 else     setBasic(FileUtils.getBasicFileAttributes(path,followLinks));
  }
  if (posixPermissions == null) {
    posixPermissions=FileUtils.emulatePosixFilePermissions(path,followLinks);
  }
}

Fixed version (ground truth):
public void UnifiedFileAttributes(Path path,BasicFileAttributes attrs,boolean followLinks){
  mPath=path;
  setBasic(attrs);
  setPosix(FileUtils.getPosixFileAttributes(path,followLinks));
  setDos(FileUtils.getDosFileAttributes(path,followLinks));
  if (getPosix() != null) {
    if (getBasic() == null)     setBasic(getPosix());
    posixPermissions=getPosix().permissions();
  }
  if (getBasic() == null) {
    if (getDos() != null)     setBasic(getDos());
 else     setBasic(FileUtils.getBasicFileAttributes(path,followLinks));
  }
  if (posixPermissions == null) {
    posixPermissions=FileUtils.emulatePosixFilePermissions(path,followLinks);
  }
}
Program: 42263
Project: 42263
Buggy source:
public XValue expand(Shell shell,EvalEnv env,SourceLocation loc) throws IOException, CoreException {
  if (this.size() == 0)   return new XValue(XdmEmptySequence.getInstance());
  if (this.size() == 1)   return this.get(0).expand(shell,env,loc);
  List<XValue> list=new ArrayList<XValue>(this.size());
  for (  Word w : this)   list.add(w.expand(shell,env,loc));
  return new XValue(list);
}

Fixed version (ground truth):
public XValue expand(Shell shell,EvalEnv env,SourceLocation loc) throws IOException, CoreException {
  if (this.size() == 0)   return new XValue(XdmEmptySequence.getInstance());
  if (this.size() == 1)   return this.get(0).expand(shell,env,loc);
  List<XValue> list=new ArrayList<XValue>(this.size());
  for (  Word w : this) {
    XValue v=w.expand(shell,env,loc);
    if ((v == null || v.isNull()) && env.omitNulls())     continue;
    list.add(v);
  }
  return new XValue(list);
}
Program: 42265
Project: 42265
Buggy source:
public void append(XValue value,CharAttr attr){
  if (value.isAtomic() && !attr.isPreserve()) {
    if (attr.isQuote() || cur != null || (achars != null && !achars.isEmpty())) {
      String str=value.toString();
      if (attr.isQuote() && Util.isEmpty(str))       return;
      append(str,attr);
    }
 else     cur=new RXValue(value,false);
  }
 else {
    if (attr.isQuote()) {
      if (value.isObject())       append(value,attr);
 else {
        boolean bFirst=true;
        for (        XdmValue v : value.asXdmValue()) {
          if (!bFirst)           append(sSEPSPACE,attr);
          append(v.toString(),attr);
          bFirst=false;
        }
      }
    }
 else {
      flush();
      add(value,attr.isPreserve());
    }
  }
}

Fixed version (ground truth):
public void append(XValue value,EvalEnv env,CharAttr attr){
  if ((value == null || value.isNull()) && env.omitNulls())   return;
  if (value.isAtomic() && !attr.isPreserve()) {
    if (attr.isQuote() || cur != null || (achars != null && !achars.isEmpty())) {
      String str=value.toString();
      if (attr.isQuote() && Util.isEmpty(str))       return;
      append(str,attr);
    }
 else     cur=new RXValue(value,false);
  }
 else {
    if (attr.isQuote()) {
      if (value.isObject())       append(value.toString(),attr);
 else {
        boolean bFirst=true;
        for (        XdmValue v : value.asXdmValue()) {
          if (!bFirst)           append(sSEPSPACE,attr);
          append(v.toString(),attr);
          bFirst=false;
        }
      }
    }
 else {
      flush();
      add(value,attr.isPreserve());
    }
  }
}
Program: 42266
Project: 42266
Buggy source:
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").replace("String_Node_Str","String_Node_Str").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();
}

Fixed version (ground truth):
public static boolean wildMatches(String pattern,String word,boolean caseSensitive){
  return compileWild(pattern,caseSensitive).matcher(word).matches();
}
Program: 42267
Project: 42267
Buggy source:
public final synchronized void release(){
  try {
    if (--mRef <= 0) {
      flush();
      close();
    }
  }
 catch (  Exception e) {
    LogManager.getLogger(getClass()).error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public final void release(){
  try {
    if (mRef.decrementAndGet() <= 0) {
synchronized (this) {
        flush();
        close();
      }
    }
  }
 catch (  Exception e) {
    LogManager.getLogger(getClass()).error("String_Node_Str",e);
  }
}
Program: 42268
Project: 42268
Buggy source:
public final synchronized void addRef(){
  mRef++;
}

Fixed version (ground truth):
public final void addRef(){
  mRef.incrementAndGet();
}
Program: 42269
Project: 42269
Buggy source:
ExplorerOptions(String connectString) throws Exception {
  if (connectString != null) {
    URI uri=new URI(connectString);
    mScheme=uri.getScheme();
    mHost=uri.getHost();
    mPort=uri.getPort();
    String userInfoStr=uri.getUserInfo();
    String[] userInfo=(userInfoStr == null) ? (new String[0]) : userInfoStr.split("String_Node_Str",2);
    String contentBase=uri.getPath();
    if (contentBase != null) {
      if (contentBase.startsWith("String_Node_Str")) {
        contentBase=contentBase.substring(1);
      }
      if (contentBase.length() == 0) {
        contentBase=uri.getFragment();
        if (contentBase != null) {
          contentBase="String_Node_Str" + contentBase;
        }
      }
    }
    mDatabase=contentBase;
    if (userInfo.length == 2) {
      mUser=userInfo[0];
      mPassword=userInfo[1];
    }
  }
  mOptions=MLUtil.newTrustOptions(mScheme);
}

Fixed version (ground truth):
ExplorerOptions(String connectString) throws Exception {
  if (!Util.isBlank(connectString)) {
    URI uri=new URI(connectString);
    mScheme=uri.getScheme();
    mHost=uri.getHost();
    mPort=uri.getPort();
    String userInfoStr=uri.getUserInfo();
    String[] userInfo=(userInfoStr == null) ? (new String[0]) : userInfoStr.split("String_Node_Str",2);
    String contentBase=uri.getPath();
    if (contentBase != null) {
      if (contentBase.startsWith("String_Node_Str")) {
        contentBase=contentBase.substring(1);
      }
      if (contentBase.length() == 0) {
        contentBase=uri.getFragment();
        if (contentBase != null) {
          contentBase="String_Node_Str" + contentBase;
        }
      }
    }
    mDatabase=contentBase;
    if (userInfo.length == 2) {
      mUser=userInfo[0];
      mPassword=userInfo[1];
    }
  }
  mOptions=MLUtil.newTrustOptions(mScheme);
}
Program: 42270
Project: 42270
Buggy source:
private boolean eval(List<XValue> av) throws Error, UnexpectedException, IOException, XPathException {
  if (av.size() == 0)   return false;
  XValue av1=av.remove(0);
  if (av.size() == 0 || av.get(0).equals("String_Node_Str"))   return evalUnary("String_Node_Str",av1);
  if (av1.isAtomic()) {
    String a1=av1.toString();
    if (a1.equals("String_Node_Str"))     return !eval(av);
    if (a1.equals("String_Node_Str")) {
      boolean ret=eval(av);
      if (av.size() < 1 || !av.remove(0).equals("String_Node_Str")) {
        throw new Error("String_Node_Str");
      }
      return ret;
    }
 else     if (a1.startsWith("String_Node_Str") && !Util.isInt(a1,true)) {
      if (av.size() < 1) {
        throw new Error("String_Node_Str" + a1);
      }
      return evalUnary(a1,av.remove(0));
    }
 else     if (av.size() == 1) {
      throw new Error("String_Node_Str" + av.remove(0));
    }
  }
  XValue op=av.remove(0);
  if (op.isAtomic())   return evalBinary(av1,op.toString(),av.remove(0));
 else   throw new Error("String_Node_Str");
}

Fixed version (ground truth):
private boolean eval(List<XValue> av) throws Error, UnexpectedException, IOException, XPathException {
  if (av.size() == 0)   return false;
  XValue av1=av.remove(0);
  if (av.size() == 0)   return evalUnary("String_Node_Str",av1);
  if (pdepth > 0 && av.get(0).equals("String_Node_Str")) {
    pdepth--;
    av.remove(0);
    return evalUnary("String_Node_Str",av1);
  }
  if (av1.isAtomic()) {
    String a1=av1.toString();
    if (a1.equals("String_Node_Str"))     return !eval(av);
    if (a1.equals("String_Node_Str")) {
      pdepth++;
      boolean ret=eval(av);
      if (av.size() < 1)       return ret;
      if (pdepth > 0 && (av.get(0).isAtomic() && av.get(0).toString().equals("String_Node_Str"))) {
        av.remove(0);
        pdepth--;
        return ret;
      }
    }
 else     if (a1.startsWith("String_Node_Str") && !Util.isInt(a1,true)) {
      if (av.size() < 1) {
        throw new Error("String_Node_Str" + a1);
      }
      return evalUnary(a1,av.remove(0));
    }
 else     if (av.size() == 1) {
      throw new Error("String_Node_Str" + av.remove(0));
    }
  }
  XValue op=av.remove(0);
  if (op.isAtomic()) {
    if (av.size() < 1)     throw new Error("String_Node_Str");
    return evalBinary(av1,op.toString(),av.remove(0));
  }
 else   throw new Error("String_Node_Str");
}
Program: 42271
Project: 42271
Buggy source:
private boolean evalUnary(String op,XValue value) throws Error, UnexpectedException, IOException, XPathException {
  if (op.equals("String_Node_Str"))   return value.isXExpr();
 else   if (op.equals("String_Node_Str"))   return value.isAtomic();
 else   if (op.equals("String_Node_Str"))   return mShell.getEnv().isDefined(value.toString());
  if (op.equals("String_Node_Str")) {
    return value.toBoolean();
  }
 else   if (op.equals("String_Node_Str")) {
    return !value.toBoolean();
  }
 else   if (op.equals("String_Node_Str"))   return getFile(value).isDirectory();
 else   if (op.equals("String_Node_Str"))   return getFile(value).exists();
 else   if (op.equals("String_Node_Str"))   return getFile(value).isFile();
 else   if (op.equals("String_Node_Str"))   return getFile(value).canRead();
 else   if (op.equals("String_Node_Str"))   return getFile(value).length() > 0;
 else   if (op.equals("String_Node_Str"))   return getFile(value).canWrite();
 else   if (op.equals("String_Node_Str"))   return getFile(value).canExecute();
 else   if (op.equals("String_Node_Str"))   return isURI(value);
 else {
    throw new Error("String_Node_Str" + op);
  }
}

Fixed version (ground truth):
private boolean evalUnary(String op,XValue value) throws Error, UnexpectedException, IOException, XPathException {
  if (op.equals("String_Node_Str"))   return value.isXExpr();
 else   if (op.equals("String_Node_Str"))   return value.isAtomic();
 else   if (op.equals("String_Node_Str"))   return mShell.getEnv().isDefined(value.toString());
  if (op.equals("String_Node_Str")) {
    return value.toBoolean();
  }
 else   if (op.equals("String_Node_Str")) {
    return !value.toBoolean();
  }
 else   if (op.equals("String_Node_Str"))   return getFile(value).getTotalSpace() > 0L;
 else   if (op.equals("String_Node_Str"))   return getFile(value).isDirectory();
 else   if (op.equals("String_Node_Str"))   return getFile(value).exists();
 else   if (op.equals("String_Node_Str"))   return getFile(value).isFile();
 else   if (op.equals("String_Node_Str"))   return getFile(value).canRead();
 else   if (op.equals("String_Node_Str"))   return getFile(value).length() > 0;
 else   if (op.equals("String_Node_Str"))   return getFile(value).canWrite();
 else   if (op.equals("String_Node_Str"))   return getFile(value).canExecute();
 else   if (op.equals("String_Node_Str"))   return isURI(value);
 else {
    throw new Error("String_Node_Str" + op);
  }
}
Program: 42272
Project: 42272
Buggy source:
public void close(){
  mIO.release();
  if (mAutoRelease != null) {
    mAutoRelease.close();
    mAutoRelease=null;
  }
}

Fixed version (ground truth):
public void close() throws CoreException {
  if (this.mSavedIO != null && !mSavedIO.isEmpty())   throw new CoreException("String_Node_Str");
  mIO.release();
  if (mAutoRelease != null) {
    mAutoRelease.close();
    mAutoRelease=null;
  }
}
Program: 42273
Project: 42273
Buggy source:
public InputPort setInput(String name,InputPort port) throws CoreException {
  InputPort in;
  if (name == null || name.equals(kSTDIN)) {
    name=kSTDIN;
    in=mInputs.getDefault();
    mStdinRedirected=true;
  }
 else   in=mInputs.get(name);
  if (in != null) {
    mInputs.removePort(in);
    in.release();
  }
  mInputs.add(new NamedPort<InputPort>(name,name.equals(kSTDIN),port));
  return port;
}

Fixed version (ground truth):
public InputPort setInput(String name,InputPort port) throws CoreException {
  InputPort in;
  if (name == null || name.equals(kSTDIN)) {
    name=kSTDIN;
    mStdinRedirected=true;
  }
  in=mInputs.removeNamed(name);
  if (in != null)   in.release();
  mInputs.add(new NamedPort<InputPort>(name,name.equals(kSTDIN),port));
  return port;
}
Program: 42274
Project: 42274
Buggy source:
public void setOutput(String name,OutputPort port) throws CoreException {
  OutputPort out;
  if (name == null) {
    out=mOutputs.getDefault();
    name=kSTDOUT;
  }
 else   out=mOutputs.get(name);
  if (out != null) {
    mOutputs.removePort(out);
    out.release();
  }
  mOutputs.add(new NamedPort<OutputPort>(name,name.equals(kSTDOUT),port));
}

Fixed version (ground truth):
public void setOutput(String name,OutputPort port) throws CoreException {
  OutputPort out;
  if (name == null)   name=kSTDOUT;
  out=mOutputs.removeNamed(name);
  if (out != null)   out.release();
  mOutputs.add(new NamedPort<OutputPort>(name,name.equals(kSTDOUT),port));
}
Program: 42275
Project: 42275
Buggy source:
public void setStderr(OutputPort err) throws CoreException {
  OutputPort stderr=mOutputs.get(kSTDERR);
  if (stderr != null) {
    mOutputs.removePort(stderr);
    stderr.release();
  }
  mOutputs.add(new NamedPort<OutputPort>(kSTDERR,false,err));
}

Fixed version (ground truth):
public void setStderr(OutputPort err) throws CoreException {
  OutputPort stderr=mOutputs.removeNamed(kSTDERR);
  if (stderr != null)   stderr.release();
  mOutputs.add(new NamedPort<OutputPort>(kSTDERR,false,err));
}
Program: 42276
Project: 42276
Buggy source:
public void close(){
  if (mEnv != null) {
    mEnv.close();
    mEnv=null;
  }
  if (mSavedCD != null)   SystemEnvironment.getInstance().setProperty("String_Node_Str",mSavedCD);
  if (mSession != null) {
    mSession.release();
    mSession=null;
  }
}

Fixed version (ground truth):
public void close(){
  try {
    if (mEnv != null) {
      mEnv.close();
      mEnv=null;
    }
    if (mSavedCD != null)     SystemEnvironment.getInstance().setProperty("String_Node_Str",mSavedCD);
    if (mSession != null) {
      mSession.release();
      mSession=null;
    }
  }
 catch (  CoreException e) {
    mLogger.error("String_Node_Str",e);
  }
}
Program: 42277
Project: 42277
Buggy source:
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean bList=opts.hasOpt("String_Node_Str");
  String dest=opts.getOptString("String_Node_Str","String_Node_Str");
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  InputPort iport=(zipfile == null ? getStdin() : getInput(zipfile));
  InputStream is=iport.asInputStream(serializeOpts);
  ZipInputStream zis=new ZipInputStream(is);
  try {
    int ret=0;
    if (bList) {
      ret=list(zis,serializeOpts,args);
      while (is.read() >= 0)       ;
    }
 else     ret=unzip(zis,getFile(dest),args);
    zis.close();
    return ret;
  }
  finally {
    zis.close();
    is.close();
    iport.close();
  }
}

Fixed version (ground truth):
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean bList=opts.hasOpt("String_Node_Str");
  String dest=opts.getOptString("String_Node_Str","String_Node_Str");
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  InputPort iport=(zipfile == null ? getStdin() : getInput(zipfile));
  InputStream is=iport.asInputStream(serializeOpts);
  ZipInputStream zis=new ZipInputStream(is);
  try {
    int ret=0;
    if (bList) {
      ret=list(zis,serializeOpts,args);
    }
 else     ret=unzip(zis,getFile(dest),args);
    while (is.read() >= 0)     ;
    zis.close();
    return ret;
  }
  finally {
    zis.close();
    is.close();
    iport.close();
  }
}
Program: 42278
Project: 42278
Buggy source:
public final synchronized void release(){
  try {
    flush();
    if (--mRef <= 0)     close();
  }
 catch (  Exception e) {
    LogManager.getLogger(getClass()).error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public final synchronized void release(){
  try {
    if (--mRef <= 0) {
      flush();
      close();
    }
  }
 catch (  Exception e) {
    LogManager.getLogger(getClass()).error("String_Node_Str",e);
  }
}
Program: 42279
Project: 42279
Buggy source:
@Override public SequenceIterator call(SequenceIterator[] arguments,XPathContext context) throws XPathException {
  String command=arguments[0].next().getStringValue();
  SequenceIterator args=arguments.length > 1 ? arguments[1] : null;
  Shell shell=ShellContext.get();
  try {
    if (shell == null)     shell=new Shell();
 else     shell=shell.clone();
    Command cmd=shell.parseEval(command);
    List<XValue> shell_args=new ArrayList<XValue>();
    Item item=null;
    if (args != null) {
      while ((item=args.next()) != null) {
        shell_args.add(new XValue(item));
      }
    }
    XValue oValue=new XValue();
    XVariable oVar=new XVariable("String_Node_Str",oValue);
    VariableOutputPort oPort=new VariableOutputPort(oVar);
    shell.getEnv().setStdout(oPort);
    Item contextItem=null;
    if (arguments.length > 2)     contextItem=arguments[2].next();
 else     contextItem=context.getContextItem();
    if (context != null) {
      VariableInputPort iPort=new VariableInputPort(new XVariable("String_Node_Str",new XValue(contextItem)));
      shell.getEnv().setStdin(iPort);
    }
    shell.setArgs(shell_args);
    try {
      shell.exec(cmd);
    }
 catch (    ThrowException e) {
      mLogger.info("String_Node_Str",e);
      return null;
    }
    oValue=oVar.getValue();
    if (oValue == null)     return null;
    return oValue.asSequenceIterator();
  }
 catch (  Exception e) {
    throw new XPathException(e);
  }
 finally {
    shell.close();
  }
}

Fixed version (ground truth):
@Override public SequenceIterator call(SequenceIterator[] arguments,XPathContext context) throws XPathException {
  String command=arguments[0].next().getStringValue();
  SequenceIterator args=arguments.length > 1 ? arguments[1] : null;
  Shell shell=ShellContext.get();
  try {
    if (shell == null)     shell=new Shell();
 else     shell=shell.clone();
    Command cmd=shell.parseEval(command);
    List<XValue> shell_args=new ArrayList<XValue>();
    Item item=null;
    if (args != null) {
      while ((item=args.next()) != null) {
        shell_args.add(new XValue(item));
      }
    }
    XValue oValue=new XValue();
    XVariable oVar=new XVariable("String_Node_Str",oValue);
    VariableOutputPort oPort=new VariableOutputPort(oVar);
    shell.getEnv().setStdout(oPort);
    Item contextItem=null;
    if (arguments.length > 2)     contextItem=arguments[2].next();
 else     contextItem=context.getContextItem();
    if (context != null) {
      VariableInputPort iPort=new VariableInputPort(new XVariable("String_Node_Str",new XValue(contextItem)));
      shell.getEnv().setStdin(iPort);
    }
    shell.setArgs(shell_args);
    try {
      shell.exec(cmd);
    }
 catch (    ThrowException e) {
      mLogger.info("String_Node_Str",e);
      return null;
    }
    oPort.release();
    oValue=oVar.getValue();
    if (oValue == null)     return null;
    return oValue.asSequenceIterator();
  }
 catch (  Exception e) {
    throw new XPathException(e);
  }
 finally {
    shell.close();
  }
}
Program: 42280
Project: 42280
Buggy source:
public void serialize(OutputStream out,SerializeOpts opt) throws UnsupportedEncodingException, IOException, SaxonApiException {
  if (isAtomic())   out.write(toString().getBytes(opt.getEncoding()));
 else   if (mValue instanceof XdmValue) {
    Serializer ser=Util.getSerializer(opt);
    ser.setOutputStream(out);
    Util.writeXdmValue(asXdmValue(),ser);
  }
}

Fixed version (ground truth):
public void serialize(OutputStream out,SerializeOpts opt) throws UnsupportedEncodingException, IOException, SaxonApiException {
  if (isAtomic() || isObject())   out.write(toString().getBytes(opt.getEncoding()));
 else   if (mValue instanceof XdmValue) {
    Serializer ser=Util.getSerializer(opt);
    ser.setOutputStream(out);
    Util.writeXdmValue(asXdmValue(),ser);
  }
}
Program: 42281
Project: 42281
Buggy source:
public String toString(){
  if (mValue != null) {
    if (isAtomic())     return mValue.toString();
 else {
      try {
        return new String(toBytes("String_Node_Str"),"String_Node_Str");
      }
 catch (      UnsupportedEncodingException e) {
        mLogger.warn("String_Node_Str");
      }
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public String toString(){
  if (mValue != null) {
    if (isAtomic() || isObject())     return mValue.toString();
 else {
      try {
        return new String(toBytes("String_Node_Str"),"String_Node_Str");
      }
 catch (      UnsupportedEncodingException e) {
        mLogger.warn("String_Node_Str");
      }
    }
  }
  return "String_Node_Str";
}
Program: 42282
Project: 42282
Buggy source:
public boolean isAtomic(){
  if (mValue == null)   return true;
  if (!(mValue instanceof XdmValue))   return true;
  ValueRepresentation value=asXdmValue().getUnderlyingValue();
  boolean isAtom=(value instanceof AtomicValue) || (value instanceof NodeInfo && ((NodeInfo)value).getNodeKind() == net.sf.saxon.type.Type.TEXT);
  return isAtom;
}

Fixed version (ground truth):
public boolean isAtomic(){
  if (mValue == null)   return true;
  if (!(mValue instanceof XdmValue))   return false;
  ValueRepresentation value=asXdmValue().getUnderlyingValue();
  boolean isAtom=(value instanceof AtomicValue) || (value instanceof NodeInfo && ((NodeInfo)value).getNodeKind() == net.sf.saxon.type.Type.TEXT);
  return isAtom;
}
Program: 42283
Project: 42283
Buggy source:
public static List<XValue> expandSequences(List<XValue> values){
  if (values.isEmpty())   return values;
  ArrayList<XValue> list=new ArrayList<XValue>(values.size());
  for (  XValue arg : values) {
    if (arg.isAtomic())     list.add(arg);
 else {
      XdmValue xv=arg.asXdmValue();
      Iterator<XdmItem> iter=xv.iterator();
      while (iter.hasNext())       list.add(new XValue(iter.next()));
    }
  }
  return list;
}

Fixed version (ground truth):
public static List<XValue> expandSequences(List<XValue> values){
  if (values.isEmpty())   return values;
  ArrayList<XValue> list=new ArrayList<XValue>(values.size());
  for (  XValue arg : values) {
    if (arg.isAtomic() || arg.isObject())     list.add(arg);
 else {
      XdmValue xv=arg.asXdmValue();
      Iterator<XdmItem> iter=xv.iterator();
      while (iter.hasNext())       list.add(new XValue(iter.next()));
    }
  }
  return list;
}
Program: 42284
Project: 42284
Buggy source:
@Override public int exec(Shell shell) throws Exception {
  XValue ret=null;
  if (mArg == null)   ret=new XValue(0);
 else   ret=mArg.expand(shell,false,false,false,getLocation()).get(0);
  shell.exec_return(ret);
  return 0;
}

Fixed version (ground truth):
@Override public int exec(Shell shell) throws Exception {
  XValue ret=null;
  if (mArg == null)   ret=new XValue(0);
 else {
    List<XValue> vret=mArg.expand(shell,false,false,false,getLocation());
    if (vret == null || vret.isEmpty())     ret=new XValue();
 else     ret=vret.get(0);
  }
  shell.exec_return(ret);
  return 0;
}
Program: 42286
Project: 42286
Buggy source:
private void writeXML(Properties props,String comment) throws IOException, CoreException, SaxonApiException, XMLStreamException {
  SerializeOpts serializeOpts=getSerializeOpts();
  ByteArrayOutputStream oss=new ByteArrayOutputStream();
  props.storeToXML(oss,comment,serializeOpts.getEncoding());
  ByteArrayInputStream iss=new ByteArrayInputStream(oss.toByteArray());
  XMLInputFactory factory=XMLInputFactory.newInstance();
  factory.setProperty(XMLInputFactory.SUPPORT_DTD,new Boolean(false));
  XMLEventReader reader=factory.createXMLEventReader(null,iss);
  XMLEventWriter writer=getStdout().asXMLEventWriter(serializeOpts);
  writer.add(reader);
  reader.close();
  writer.close();
}

Fixed version (ground truth):
private void writeXML(Properties props,String comment) throws IOException, CoreException, SaxonApiException, XMLStreamException {
  SerializeOpts serializeOpts=getSerializeOpts();
  ByteArrayOutputStream oss=new ByteArrayOutputStream();
  props.storeToXML(oss,comment,serializeOpts.getEncoding());
  ByteArrayInputStream iss=new ByteArrayInputStream(oss.toByteArray());
  XMLInputFactory factory=XMLInputFactory.newInstance();
  factory.setProperty(XMLInputFactory.SUPPORT_DTD,Boolean.valueOf(false));
  XMLEventReader reader=factory.createXMLEventReader(null,iss);
  XMLEventWriter writer=getStdout().asXMLEventWriter(serializeOpts);
  writer.add(reader);
  reader.close();
  writer.close();
}
Program: 42287
Project: 42287
Buggy source:
private void runUpdate(Connection conn,SerializeOpts serializeOpts,String root,String row,String query,boolean bAttr,int batch) throws SQLException, IOException, InvalidArgumentException, XMLStreamException {
  Statement pStmt=null;
  ResultSet rs=null;
  try {
    pStmt=conn.createStatement();
    OutputPort stdout=getStdout();
    XMLStreamWriter writer=stdout.asXMLStreamWriter(serializeOpts);
    writer.writeStartDocument();
    writer.writeStartElement(root);
    int rows=pStmt.executeUpdate(query);
    writer.writeAttribute("String_Node_Str",String.valueOf(rows));
    writer.writeEndElement();
    writer.writeEndDocument();
    stdout.writeSequenceTerminator(serializeOpts);
    writer.close();
  }
  finally {
    try {
      if (rs != null)       rs.close();
      if (pStmt != null)       pStmt.close();
      if (conn != null)       conn.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
private void runUpdate(Connection conn,SerializeOpts serializeOpts,String root,String row,String query,boolean bAttr,int batch) throws SQLException, IOException, InvalidArgumentException, XMLStreamException {
  Statement pStmt=null;
  try {
    pStmt=conn.createStatement();
    OutputPort stdout=getStdout();
    XMLStreamWriter writer=stdout.asXMLStreamWriter(serializeOpts);
    writer.writeStartDocument();
    writer.writeStartElement(root);
    int rows=pStmt.executeUpdate(query);
    writer.writeAttribute("String_Node_Str",String.valueOf(rows));
    writer.writeEndElement();
    writer.writeEndDocument();
    stdout.writeSequenceTerminator(serializeOpts);
    writer.close();
  }
  finally {
    try {
      if (pStmt != null)       pStmt.close();
    }
 catch (    Exception e) {
      mLogger.error("String_Node_Str",e);
    }
  }
}
Program: 42288
Project: 42288
Buggy source:
private void runQuery(Connection conn,SerializeOpts serializeOpts,String root,String row,String query,boolean bAttr,String fetch) throws SQLException, IOException, InvalidArgumentException, XMLStreamException {
  Statement pStmt=null;
  ResultSet rs=null;
  try {
    pStmt=conn.createStatement();
    if (fetch != null)     pStmt.setFetchSize(Util.parseInt(fetch,1));
    OutputPort stdout=getStdout();
    XMLStreamWriter writer=stdout.asXMLStreamWriter(serializeOpts);
    writer.writeStartDocument();
    writer.writeStartElement(root);
    rs=pStmt.executeQuery(query);
    ResultSetMetaData meta=rs.getMetaData();
    while (rs.next()) {
      addElement(writer,rs,row,bAttr,meta);
    }
    writer.writeEndElement();
    writer.writeEndDocument();
    stdout.writeSequenceTerminator(serializeOpts);
    writer.close();
  }
  finally {
    try {
      if (rs != null)       rs.close();
      if (pStmt != null)       pStmt.close();
      if (conn != null)       conn.close();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
private void runQuery(Connection conn,SerializeOpts serializeOpts,String root,String row,String query,boolean bAttr,String fetch) throws SQLException, IOException, InvalidArgumentException, XMLStreamException {
  Statement pStmt=null;
  ResultSet rs=null;
  try {
    pStmt=conn.createStatement();
    if (fetch != null)     pStmt.setFetchSize(Util.parseInt(fetch,1));
    OutputPort stdout=getStdout();
    XMLStreamWriter writer=stdout.asXMLStreamWriter(serializeOpts);
    writer.writeStartDocument();
    writer.writeStartElement(root);
    rs=pStmt.executeQuery(query);
    ResultSetMetaData meta=rs.getMetaData();
    while (rs.next()) {
      addElement(writer,rs,row,bAttr,meta);
    }
    writer.writeEndElement();
    writer.writeEndDocument();
    stdout.writeSequenceTerminator(serializeOpts);
    writer.close();
  }
  finally {
    try {
      if (rs != null)       rs.close();
      if (pStmt != null)       pStmt.close();
    }
 catch (    Exception e) {
      mLogger.error("String_Node_Str",e);
    }
  }
}
Program: 42289
Project: 42289
Buggy source:
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean bList=opts.hasOpt("String_Node_Str");
  String dest=opts.getOptString("String_Node_Str","String_Node_Str");
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  InputPort iport=(zipfile == null ? getStdin() : getInput(zipfile));
  InputStream is=iport.asInputStream(serializeOpts);
  ZipInputStream zis=new ZipInputStream(is);
  try {
    int ret=0;
    if (bList) {
      ret=list(zis,serializeOpts,args);
      while (is.read() >= 0)       ;
    }
 else     ret=unzip(zis,getFile(dest),args);
    zis.close();
  }
  finally {
    zis.close();
    is.close();
    iport.close();
  }
  return 0;
}

Fixed version (ground truth):
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean bList=opts.hasOpt("String_Node_Str");
  String dest=opts.getOptString("String_Node_Str","String_Node_Str");
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  InputPort iport=(zipfile == null ? getStdin() : getInput(zipfile));
  InputStream is=iport.asInputStream(serializeOpts);
  ZipInputStream zis=new ZipInputStream(is);
  try {
    int ret=0;
    if (bList) {
      ret=list(zis,serializeOpts,args);
      while (is.read() >= 0)       ;
    }
 else     ret=unzip(zis,getFile(dest),args);
    zis.close();
    return ret;
  }
  finally {
    zis.close();
    is.close();
    iport.close();
  }
}
Program: 42290
Project: 42290
Buggy source:
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  ZipOutputStream zos=new ZipOutputStream(zipfile == null ? getStdout().asOutputStream(serializeOpts) : this.getOutputStream(zipfile.toString(),false));
  try {
    int ret=0;
    ret=zip(zos,args);
    zos.finish();
  }
  finally {
    zos.close();
  }
  return 0;
}

Fixed version (ground truth):
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  XValue zipfile=opts.getOptValue("String_Node_Str");
  args=opts.getRemainingArgs();
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  ZipOutputStream zos=new ZipOutputStream(zipfile == null ? getStdout().asOutputStream(serializeOpts) : this.getOutputStream(zipfile.toString(),false));
  try {
    int ret=0;
    ret=zip(zos,args);
    zos.finish();
    return ret;
  }
  finally {
    zos.close();
  }
}
Program: 42291
Project: 42291
Buggy source:
public synchronized void flush() throws CoreException {
  if (mXdmDestination != null)   appendVar(mXdmDestination.getXdmNode());
  if (mByteArrayOutputStream != null)   try {
    appendVar(mByteArrayOutputStream.toString(mSerializeOpts.getText_encoding()));
  }
 catch (  UnsupportedEncodingException e1) {
    throw new CoreException(e1);
  }
  if (mBuilder != null)   appendVar((XdmNode)S9Util.wrapNode(mBuilder.getCurrentRoot()));
  if (mWriterBuffer != null) {
    DocumentBuilder builder=Shell.getProcessor().newDocumentBuilder();
    XdmNode node;
    try {
      node=builder.build(new StAXSource(mWriterBuffer.getReader()));
    }
 catch (    Exception e) {
      throw new CoreException(e);
    }
    appendVar(node);
  }
  mXdmDestination=null;
  mByteArrayOutputStream=null;
  mBuilder=null;
  mWriterBuffer=null;
}

Fixed version (ground truth):
public synchronized void flush() throws CoreException {
  if (mXdmDestination != null)   appendVar(mXdmDestination.getXdmNode());
  if (mByteArrayOutputStream != null)   try {
    appendVar(mByteArrayOutputStream.toString(mSerializeOpts.getText_encoding()));
  }
 catch (  UnsupportedEncodingException e1) {
    throw new CoreException(e1);
  }
  if (mBuilder != null)   appendVar((XdmNode)S9Util.wrapNode(mBuilder.getCurrentRoot()));
  mXdmDestination=null;
  mByteArrayOutputStream=null;
  mBuilder=null;
}
Program: 42292
Project: 42292
Buggy source:
@Override public ContentHandler asContentHandler(SerializeOpts opts) throws XPathException {
  ReceivingContentHandler rch=new ReceivingContentHandler();
  Receiver r=null;
  Builder b=new TinyBuilder();
  PipelineConfiguration pipe=Shell.getProcessor().getUnderlyingConfiguration().makePipelineConfiguration();
  b.setPipelineConfiguration(pipe);
  r=b;
  rch.setReceiver(r);
  rch.setPipelineConfiguration(pipe);
  mBuilder=b;
  return rch;
}

Fixed version (ground truth):
@Override public synchronized ContentHandler asContentHandler(SerializeOpts opts) throws XPathException {
  ReceivingContentHandler rch=new ReceivingContentHandler();
  Receiver r=null;
  Builder b=new TinyBuilder();
  PipelineConfiguration pipe=Shell.getProcessor().getUnderlyingConfiguration().makePipelineConfiguration();
  b.setPipelineConfiguration(pipe);
  r=b;
  rch.setReceiver(r);
  rch.setPipelineConfiguration(pipe);
  mBuilder=b;
  return rch;
}
Program: 42293
Project: 42293
Buggy source:
public void validate(String systemid,InputStream xml) throws Exception {
  XMLValidationSchemaFactory sf=XMLValidationSchemaFactory.newInstance(XMLValidationSchema.SCHEMA_ID_DTD);
  XMLValidationSchema rng=sf.createSchema(mDTD);
  XMLInputFactory2 ifact=(XMLInputFactory2)XMLInputFactory.newInstance();
  ifact.setProperty(XMLInputFactory2.P_DTD_OVERRIDE,null);
  ifact.setProperty(XMLInputFactory.SUPPORT_DTD,new Boolean(false));
  XMLStreamReader2 sr=(XMLStreamReader2)ifact.createXMLStreamReader(systemid,xml);
  sr.validateAgainst(rng);
  while (sr.hasNext()) {
    sr.next();
  }
}

Fixed version (ground truth):
public void validate(String systemid,InputStream xml) throws Exception {
  XMLValidationSchemaFactory sf=XMLValidationSchemaFactory.newInstance(XMLValidationSchema.SCHEMA_ID_DTD);
  XMLValidationSchema rng=sf.createSchema(mDTD);
  XMLInputFactory2 ifact=(XMLInputFactory2)XMLInputFactory.newInstance();
  ifact.setProperty(XMLInputFactory2.P_DTD_OVERRIDE,null);
  ifact.setProperty(XMLInputFactory.SUPPORT_DTD,Boolean.valueOf(false));
  XMLStreamReader2 sr=(XMLStreamReader2)ifact.createXMLStreamReader(systemid,xml);
  sr.validateAgainst(rng);
  while (sr.hasNext()) {
    sr.next();
  }
}
Program: 42294
Project: 42294
Buggy source:
public void execute() throws BuildException {
  mLogger.info("String_Node_Str");
  Shell shell=null;
  try {
    shell=new Shell();
    List<XValue> vargs=new ArrayList<XValue>();
    if (mScript != null)     vargs.add(new XValue(mScript));
 else {
      vargs.add(new XValue("String_Node_Str"));
      vargs.add(new XValue(mText));
    }
    if (mArgs != null) {
      for (      Arg arg : mArgs)       vargs.add(new XValue(arg.mValue));
    }
    org.xmlsh.commands.builtin.xmlsh cmd=new org.xmlsh.commands.builtin.xmlsh(true);
    int ret=cmd.run(shell,"String_Node_Str",vargs);
  }
 catch (  Exception e) {
    throw new BuildException(e);
  }
 finally {
    if (shell != null)     shell.close();
  }
}

Fixed version (ground truth):
public void execute() throws BuildException {
  mLogger.info("String_Node_Str");
  Shell shell=null;
  try {
    shell=new Shell();
    List<XValue> vargs=new ArrayList<XValue>();
    if (mScript != null)     vargs.add(new XValue(mScript));
 else {
      vargs.add(new XValue("String_Node_Str"));
      vargs.add(new XValue(mText));
    }
    if (mArgs != null) {
      for (      Arg arg : mArgs)       vargs.add(new XValue(arg.mValue));
    }
    org.xmlsh.commands.builtin.xmlsh cmd=new org.xmlsh.commands.builtin.xmlsh(true);
    @SuppressWarnings("String_Node_Str") int ret=cmd.run(shell,"String_Node_Str",vargs);
  }
 catch (  Exception e) {
    throw new BuildException(e);
  }
 finally {
    if (shell != null)     shell.close();
  }
}
Program: 42297
Project: 42297
Buggy source:
public void exit(int retval){
  mExitVal=new Integer(retval);
}

Fixed version (ground truth):
public void exit(int retval){
  mExitVal=Integer.valueOf(retval);
}
Program: 42298
Project: 42298
Buggy source:
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean nolf=opts.hasOpt("String_Node_Str");
  String port=opts.getOptString("String_Node_Str",null);
  OutputPort stdout=port != null ? mShell.getEnv().getOutputPort(port) : mShell.getEnv().getStdout();
  if (stdout == null)   throw new InvalidArgumentException("String_Node_Str" + port);
  OutputStream out=stdout.asOutputStream();
  args=opts.getRemainingArgs();
  args=Util.expandSequences(args);
  boolean bFirst=true;
  for (  XValue arg : args) {
    if (!bFirst)     out.write(' ');
    bFirst=false;
    arg.serialize(out,getSerializeOpts(opts));
  }
  if (!nolf)   out.write(Util.getNewline(getSerializeOpts(opts)));
  out.flush();
  return 0;
}

Fixed version (ground truth):
public int run(List<XValue> args) throws Exception {
  Options opts=new Options("String_Node_Str",SerializeOpts.getOptionDefs());
  opts.parse(args);
  boolean nolf=opts.hasOpt("String_Node_Str");
  String port=opts.getOptString("String_Node_Str",null);
  OutputPort stdout=port != null ? mShell.getEnv().getOutputPort(port) : mShell.getEnv().getStdout();
  if (stdout == null)   throw new InvalidArgumentException("String_Node_Str" + port);
  SerializeOpts serializeOpts=getSerializeOpts(opts);
  OutputStream out=stdout.asOutputStream(serializeOpts);
  args=opts.getRemainingArgs();
  args=Util.expandSequences(args);
  boolean bFirst=true;
  for (  XValue arg : args) {
    if (!bFirst)     out.write(' ');
    bFirst=false;
    arg.serialize(out,serializeOpts);
  }
  if (!nolf)   out.write(Util.getNewline(serializeOpts));
  out.flush();
  return 0;
}