nus-yam/ex-repair huggingface dataset:
Program: 134618
Project: 134618
Buggy source:
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  Activity activity=getActivity();
  if (isSavable()) {
    Storable storable=(Storable)readable;
    if (reader.isCompleted()) {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_DELETE));
    }
 else {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_INSERT));
    }
  }
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  activity.finish();
  super.onStop();
}

Fixed version (ground truth):
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  Activity activity=getActivity();
  if (isStorable()) {
    Storable storable=(Storable)readable;
    if (reader.isCompleted()) {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_DELETE));
    }
 else {
      activity.startService(createLastReadServiceIntent(activity,storable,Constants.DB_OPERATION_INSERT));
    }
  }
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  activity.finish();
  super.onStop();
}
Program: 134619
Project: 134619
Buggy source:
private int calcDelay(int wordLength){
  return delayList.get(position++ % wordLength) * Math.round(100 * 60 * 1f / settingsBundle.getWPM());
}

Fixed version (ground truth):
private int calcDelay(){
  return delayList.get(position) * Math.round(100 * 60 * 1f / settingsBundle.getWPM());
}
Program: 134620
Project: 134620
Buggy source:
public String getNextFormat(int pos){
  int charLen=0;
  int i=pos;
  StringBuilder format=new StringBuilder("String_Node_Str");
  while (charLen < 40 && i < wordList.size() - 1) {
    String word=wordList.get(++i);
    if (TextUtils.isEmpty(word)) {
      charLen+=word.length() + 1;
      format.append(word).append("String_Node_Str");
    }
  }
  format.append("String_Node_Str");
  return format.toString();
}

Fixed version (ground truth):
public String getNextFormat(int pos){
  int charLen=0;
  int i=pos;
  StringBuilder format=new StringBuilder("String_Node_Str");
  while (charLen < 40 && i < wordList.size() - 1) {
    String word=wordList.get(++i);
    if (!TextUtils.isEmpty(word)) {
      charLen+=word.length() + 1;
      format.append(word).append("String_Node_Str");
    }
  }
  format.append("String_Node_Str");
  return format.toString();
}
Program: 134621
Project: 134621
Buggy source:
private void receiveParser(Context context,Intent intent){
  try {
    parser=TextParser.fromString(intent.getStringExtra(Constants.EXTRA_PARSER));
    parserReceived=true;
    readable=parser.getReadable();
    wordList=readable.getWordList();
    emphasisList=readable.getEmphasisList();
    delayList=readable.getDelayList();
    YoYo.with(Techniques.FadeOut).duration(Constants.SECOND / 2).playOn(parsingProgressBar);
    readerLayout.setVisibility(View.VISIBLE);
    YoYo.with(Techniques.BounceIn).duration(2 * Constants.SECOND).playOn(readerLayout);
    final Handler handler=new Handler();
    reader=new Reader(handler,Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
    handler.postDelayed(reader,3 * Constants.SECOND);
    if (isSavable())     context.startService(createLastReadServiceIntent(context,(Storable)readable,Constants.DB_OPERATION_INSERT));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void receiveParser(Context context,Intent intent){
  try {
    parser=TextParser.fromString(intent.getStringExtra(Constants.EXTRA_PARSER));
    parserReceived=true;
    readable=parser.getReadable();
    wordList=readable.getWordList();
    emphasisList=readable.getEmphasisList();
    delayList=readable.getDelayList();
    YoYo.with(Techniques.FadeOut).duration(Constants.SECOND / 2).playOn(parsingProgressBar);
    readerLayout.setVisibility(View.VISIBLE);
    YoYo.with(Techniques.BounceIn).duration(2 * Constants.SECOND).playOn(readerLayout);
    final Handler handler=new Handler();
    readable.setPosition(Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
    reader=new Reader(handler,readable.getPosition());
    handler.postDelayed(reader,3 * Constants.SECOND);
    if (isStorable())     context.startService(createLastReadServiceIntent(context,(Storable)readable,Constants.DB_OPERATION_INSERT));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
}
Program: 134622
Project: 134622
Buggy source:
protected int measureWord(String word){
  if (word.length() == 0)   return delayCoefficients.get(0);
  int res=0;
  for (  char ch : word.toCharArray()) {
    int tempRes=delayCoefficients.get(0);
    if (ch == '-')     tempRes=delayCoefficients.get(1);
    if (ch == '\t')     tempRes=delayCoefficients.get(4);
switch (ch) {
case ',':
      tempRes=delayCoefficients.get(1);
    break;
case '.':
  tempRes=delayCoefficients.get(2);
break;
case '!':
tempRes=delayCoefficients.get(2);
break;
case '?':
tempRes=delayCoefficients.get(2);
break;
case '-':
tempRes=delayCoefficients.get(3);
break;
case '—':
tempRes=delayCoefficients.get(3);
break;
case ':':
tempRes=delayCoefficients.get(3);
break;
case ';':
tempRes=delayCoefficients.get(3);
break;
case '\n':
tempRes=delayCoefficients.get(4);
}
res=Math.max(res,tempRes);
}
return res;
}

Fixed version (ground truth):
protected int measureWord(String word){
  if (word.length() == 0)   return delayCoefficients.get(0);
  int res=0;
  for (  char ch : word.toCharArray()) {
    int tempRes=delayCoefficients.get(0);
    if (ch == '\t')     tempRes=delayCoefficients.get(4);
switch (ch) {
case ',':
      tempRes=delayCoefficients.get(1);
    break;
case '.':
  tempRes=delayCoefficients.get(2);
break;
case '!':
tempRes=delayCoefficients.get(2);
break;
case '?':
tempRes=delayCoefficients.get(2);
break;
case '-':
tempRes=delayCoefficients.get(3);
break;
case '—':
tempRes=delayCoefficients.get(3);
break;
case ':':
tempRes=delayCoefficients.get(3);
break;
case ';':
tempRes=delayCoefficients.get(3);
break;
case '\n':
tempRes=delayCoefficients.get(4);
}
res=Math.max(res,tempRes);
}
return res;
}
Program: 134623
Project: 134623
Buggy source:
public void process(){
  normalize(readable);
  cutLongWords(readable);
  buildDelayList(readable);
  cleanFromHyphens(readable);
  buildEmphasis(readable);
}

Fixed version (ground truth):
public void process(){
  normalize(readable);
  cutLongWords(readable);
  readable.setWordList(Arrays.asList(readable.getText().split("String_Node_Str")));
  cleanWordList(readable);
  buildDelayList(readable);
  buildEmphasis(readable);
}
Program: 134624
Project: 134624
Buggy source:
protected void cutLongWords(Readable readable){
  String text=readable.getText();
  List<String> res=new ArrayList<String>();
  for (  String word : text.split("String_Node_Str")) {
    boolean isComplex=false;
    while (word.length() - 1 > lengthPreference) {
      isComplex=true;
      String toAppend;
      int pos=word.length() - 3;
      while (pos > 1 && !Character.isLetter(word.charAt(pos)))       --pos;
      toAppend=word.substring(0,pos);
      word=word.substring(pos);
      res.add("String_Node_Str" + toAppend + "String_Node_Str");
    }
    if (isComplex)     res.add("String_Node_Str" + word);
 else     res.add(word);
  }
  StringBuilder sb=new StringBuilder();
  for (  String s : res)   sb.append(s).append("String_Node_Str");
  readable.setText(sb.toString());
}

Fixed version (ground truth):
protected void cutLongWords(Readable readable){
  String text=readable.getText();
  List<String> res=new ArrayList<String>();
  for (  String word : text.split("String_Node_Str")) {
    boolean isComplex=false;
    while (word.length() - 1 > lengthPreference) {
      isComplex=true;
      String toAppend;
      int pos=word.length() - 3;
      while (pos > 1 && !Character.isLetter(word.charAt(pos)))       --pos;
      toAppend=word.substring(0,pos);
      word=word.substring(pos);
      res.add(toAppend + "String_Node_Str");
    }
    if (isComplex)     res.add(word);
 else     res.add(word);
  }
  StringBuilder sb=new StringBuilder();
  for (  String s : res)   sb.append(s).append("String_Node_Str");
  readable.setText(sb.toString());
}
Program: 134625
Project: 134625
Buggy source:
protected void buildEmphasis(Readable readable){
  List<String> words=readable.getWordList();
  List<Integer> res=new ArrayList<Integer>();
  for (  String word : words) {
    Map<String,Pair<Integer,Integer>> priorities=new HashMap<String,Pair<Integer,Integer>>();
    int len=word.length();
    for (int i=0; i < len; ++i) {
      if (!Character.isLetter(word.charAt(i)))       continue;
      String ch=word.substring(i,i + 1).toLowerCase();
      if (PRIORITIES.get(ch) != null && (priorities.get(ch) == null || priorities.get(ch).first < PRIORITIES.get(ch) * 100 / Math.max(1,Math.abs(len / 2 - i)))) {
        priorities.put(ch,new Pair<Integer,Integer>(PRIORITIES.get(ch) * 100 / Math.max(1,Math.abs(len / 2 - i)),i));
      }
 else       priorities.put(ch,new Pair<Integer,Integer>(0,i));
      if (i + 1 < word.length() && word.charAt(i) == word.charAt(i + 1)) {
        priorities.put(ch,new Pair<Integer,Integer>(priorities.get(ch).first * 4,i));
      }
    }
    int resInd=word.length() / 2, mmax=0;
    for (    Map.Entry<String,Pair<Integer,Integer>> entry : priorities.entrySet()) {
      if (mmax < entry.getValue().first) {
        mmax=entry.getValue().first;
        resInd=entry.getValue().second;
      }
    }
    res.add(resInd);
  }
  readable.setEmphasisList(res);
}

Fixed version (ground truth):
protected void buildEmphasis(Readable readable){
  List<Integer> res=new ArrayList<Integer>();
  for (  String word : readable.getWordList()) {
    Map<String,Pair<Integer,Integer>> priorities=new HashMap<String,Pair<Integer,Integer>>();
    int len=word.length();
    for (int i=0; i < len; ++i) {
      if (!Character.isLetter(word.charAt(i)))       continue;
      String ch=word.substring(i,i + 1).toLowerCase();
      if (PRIORITIES.get(ch) != null && (priorities.get(ch) == null || priorities.get(ch).first < PRIORITIES.get(ch) * 100 / Math.max(1,Math.abs(len / 2 - i)))) {
        priorities.put(ch,new Pair<Integer,Integer>(PRIORITIES.get(ch) * 100 / Math.max(1,Math.abs(len / 2 - i)),i));
      }
 else       priorities.put(ch,new Pair<Integer,Integer>(0,i));
      if (i + 1 < word.length() && word.charAt(i) == word.charAt(i + 1)) {
        priorities.put(ch,new Pair<Integer,Integer>(priorities.get(ch).first * 4,i));
      }
    }
    int resInd=word.length() / 2, mmax=0;
    for (    Map.Entry<String,Pair<Integer,Integer>> entry : priorities.entrySet()) {
      if (mmax < entry.getValue().first) {
        mmax=entry.getValue().first;
        resInd=entry.getValue().second;
      }
    }
    res.add(resInd);
  }
  readable.setEmphasisList(res);
}
Program: 134626
Project: 134626
Buggy source:
protected String insertSpacesAfterPunctuation(String text){
  StringBuilder res=new StringBuilder();
  String madeMeSpecial=makeMeSpecial.substring(1,9) + "String_Node_Str";
  for (  Character ch : text.toCharArray()) {
    res.append(ch);
    if (madeMeSpecial.indexOf(ch) > -1)     res.append("String_Node_Str");
  }
  return res.toString();
}

Fixed version (ground truth):
protected String insertSpacesAfterPunctuation(String text){
  StringBuilder res=new StringBuilder();
  String madeMeSpecial=makeMeSpecial.substring(1,9) + "String_Node_Str";
  for (int i=0; i < text.length(); ++i) {
    Character ch=text.charAt(i);
    res.append(ch);
    if (i < text.length() - 1) {
      Character nextCh=text.charAt(i + 1);
      if (madeMeSpecial.indexOf(ch) > -1 && Character.isLetter(nextCh))       res.append("String_Node_Str");
    }
  }
  for (  Character ch : text.toCharArray()) {
    res.append(ch);
    if (madeMeSpecial.indexOf(ch) > -1)     res.append("String_Node_Str");
  }
  return res.toString();
}
Program: 134627
Project: 134627
Buggy source:
protected void buildDelayList(Readable readable){
  String text=readable.getText();
  List<Integer> res=new ArrayList<Integer>();
  String[] words=text.split("String_Node_Str");
  for (  String word : words)   res.add(measureWord(word));
  readable.setDelayList(res);
}

Fixed version (ground truth):
protected void buildDelayList(Readable readable){
  List<Integer> res=new ArrayList<Integer>();
  for (  String word : readable.getWordList())   res.add(measureWord(word));
  readable.setDelayList(res);
}
Program: 134628
Project: 134628
Buggy source:
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  if (parserReceived && !TextUtils.isEmpty(readable.getPath()))   if (reader.isCompleted())   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_DELETE));
 else   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_INSERT));
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  getActivity().finish();
  super.onStop();
}

Fixed version (ground truth):
@Override public void onStop(){
  Log.d(LOGTAG,"String_Node_Str");
  if (parserReceived && !TextUtils.isEmpty(readable.getPath()) && settingsBundle.isCachingEnabled())   if (reader.isCompleted())   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_DELETE));
 else   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_INSERT));
  settingsBundle.updatePreferences();
  manager.unregisterReceiver(textParserListener);
  getActivity().finish();
  super.onStop();
}
Program: 134629
Project: 134629
Buggy source:
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestReadable();
    readable.setText(context.getResources().getString(R.string.sample_text));
  }
 else {
    if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(Constants.PREF_CACHE,true))     intentPath=null;
switch (intentType) {
case TYPE_TEST:
      readable=new TestReadable();
    break;
case TYPE_CLIPBOARD:
  readable=new ClipboardReadable();
break;
case TYPE_FILE:
readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) {
readable=new NetReadable(link);
}
 else {
readable=new ClipboardReadable();
readable.setText(intentText);
}
}
readable.setPath(intentPath);
}
return readable;
}

Fixed version (ground truth):
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestReadable();
    readable.setText(context.getResources().getString(R.string.sample_text));
  }
 else {
switch (intentType) {
case TYPE_TEST:
      readable=new TestReadable();
    break;
case TYPE_CLIPBOARD:
  readable=new ClipboardReadable();
break;
case TYPE_FILE:
readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) {
readable=new NetReadable(link);
}
 else {
readable=new ClipboardReadable();
readable.setText(intentText);
}
}
readable.setPath(intentPath);
}
return readable;
}
Program: 134630
Project: 134630
Buggy source:
private void continueParserParty(){
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  YoYo.with(Techniques.FlipOutY).duration(Constants.SECOND).playOn(parsingProgressBar);
  readerLayout.setVisibility(View.VISIBLE);
  YoYo.with(Techniques.FadeIn).duration(2 * Constants.SECOND).playOn(readerLayout);
  if (isSavable())   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_INSERT));
  final Handler handler=new Handler();
  reader=new Reader(handler,Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
  handler.postDelayed(reader,3 * Constants.SECOND);
}

Fixed version (ground truth):
private void continueParserParty(){
  readable=parser.getReadable();
  wordList=readable.getWordList();
  emphasisList=readable.getEmphasisList();
  delayList=readable.getDelayList();
  YoYo.with(Techniques.FlipOutY).duration(Constants.SECOND).playOn(parsingProgressBar);
  readerLayout.setVisibility(View.VISIBLE);
  YoYo.with(Techniques.FadeIn).duration(2 * Constants.SECOND).playOn(readerLayout);
  final Handler handler=new Handler();
  reader=new Reader(handler,Math.max(readable.getPosition() - Constants.READER_START_OFFSET,0));
  handler.postDelayed(reader,3 * Constants.SECOND);
  if (isSavable())   getActivity().startService(createLastReadServiceIntent((Storable)readable,Constants.DB_OPERATION_INSERT));
}
Program: 134631
Project: 134631
Buggy source:
private Bundle bundleReceivedData(){
  Bundle bundle=getIntent().getExtras();
  if (bundle != null && TextUtils.isEmpty(bundle.getString(Intent.EXTRA_TEXT)) && TextUtils.isEmpty(bundle.getString(Constants.EXTRA_TYPE)))   bundle.putInt(Constants.EXTRA_TYPE,Readable.TYPE_TEST);
  Log.d(LOGTAG,"String_Node_Str" + ((bundle == null) ? "String_Node_Str" : bundle.toString()));
  return bundle;
}

Fixed version (ground truth):
private Bundle bundleReceivedData(){
  Bundle bundle=getIntent().getExtras();
  if (bundle != null && !bundle.containsKey(Intent.EXTRA_TEXT) && !bundle.containsKey(Constants.EXTRA_TYPE))   bundle.putInt(Constants.EXTRA_TYPE,Readable.TYPE_TEST);
  Log.d(LOGTAG,"String_Node_Str" + ((bundle == null) ? "String_Node_Str" : bundle.toString()));
  return bundle;
}
Program: 134632
Project: 134632
Buggy source:
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileReadable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    makeExtension();
    StringBuilder text=new StringBuilder();
    type=-1;
    if ("String_Node_Str".equals(extension)) {
      FileReader fileReader=new FileReader(path);
      BufferedReader br=new BufferedReader(fileReader);
      String sCurrentLine;
      while ((sCurrentLine=br.readLine()) != null)       text.append(sCurrentLine).append('\n');
      br.close();
      type=TYPE_TXT;
      Log.d(LOGTAG,"String_Node_Str");
    }
    if ("String_Node_Str".equals(extension)) {
      Book book=(new EpubReader()).readEpub(new FileInputStream(path));
      for (      Resource res : book.getContents())       text.append(new String(res.getData()));
      text=new StringBuilder(parseEpub(text.toString()));
      type=TYPE_EPUB;
      Log.d(LOGTAG,"String_Node_Str");
    }
    this.text=text;
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
  if (processFailed=type == -1) {
    Toast.makeText(context,R.string.wrong_ext,Toast.LENGTH_SHORT).show();
  }
 else {
    rowData=takeRowData(context);
    if (rowData != null)     position=rowData.getPosition();
  }
}

Fixed version (ground truth):
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileReadable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    makeExtension();
    StringBuilder text=new StringBuilder();
    type=-1;
    if ("String_Node_Str".equals(extension))     processTxt();
    if ("String_Node_Str".equals(extension))     processEpub();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
  if (processFailed=type == -1) {
    Toast.makeText(context,R.string.wrong_ext,Toast.LENGTH_SHORT).show();
  }
 else {
    rowData=takeRowData(context);
    if (rowData != null)     position=rowData.getPosition();
  }
}
Program: 134633
Project: 134633
Buggy source:
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestReadable();
    readable.setText(context.getResources().getString(R.string.sample_text));
  }
 else {
switch (intentType) {
case TYPE_TEST:
      readable=new TestReadable();
    break;
case TYPE_CLIPBOARD:
  readable=new ClipboardReadable();
break;
case TYPE_FILE:
readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) {
readable=new NetReadable(link);
}
 else {
readable=new ClipboardReadable();
readable.setText(intentText);
}
}
readable.setPath(intentPath);
}
return readable;
}

Fixed version (ground truth):
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestReadable();
  }
 else {
switch (intentType) {
case TYPE_TEST:
      readable=new TestReadable();
    break;
case TYPE_CLIPBOARD:
  readable=new ClipboardReadable();
break;
case TYPE_FILE:
readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) {
readable=new NetReadable(link);
}
 else {
readable=new ClipboardReadable();
readable.setText(intentText);
}
}
readable.setPath(intentPath);
}
return readable;
}
Program: 134634
Project: 134634
Buggy source:
public TestReadable(){
  super();
  setPath(null);
}

Fixed version (ground truth):
public TestReadable(){
  super();
  path=null;
}
Program: 134635
Project: 134635
Buggy source:
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileReadable.uriToStringPath(context,Uri.parse(path));
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    extension=MimeTypeMap.getFileExtensionFromUrl(path);
    if ("String_Node_Str".equals(extension)) {
      FileReader fileReader=new FileReader(path);
      BufferedReader br=new BufferedReader(fileReader);
      String sCurrentLine;
      while ((sCurrentLine=br.readLine()) != null)       text.append(sCurrentLine).append('\n');
      br.close();
      type=TYPE_TXT;
      textType="String_Node_Str";
      Log.d(LOGTAG,"String_Node_Str");
    }
    if ("String_Node_Str".equals(extension)) {
      Book book=(new EpubReader()).readEpub(new FileInputStream(path));
      for (      Resource res : book.getContents())       text.append(new String(res.getData()));
      type=TYPE_EPUB;
      textType="String_Node_Str";
      Log.d(LOGTAG,"String_Node_Str");
    }
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
  if (processFailed=type == -1)   Toast.makeText(context,R.string.wrong_ext,Toast.LENGTH_SHORT).show();
 else {
    rowData=Readable.getRowData(context.getContentResolver().query(LastReadContentProvider.CONTENT_URI,null,null,null,null),path);
    if (rowData != null)     position=rowData.getPosition();
  }
}

Fixed version (ground truth):
public void process(Context context){
  Log.d(LOGTAG,"String_Node_Str");
  try {
    path=FileReadable.takePath(context,path);
    if (path == null) {
      Log.d(LOGTAG,"String_Node_Str");
      return;
    }
    extension=MimeTypeMap.getFileExtensionFromUrl(path);
    StringBuilder text=new StringBuilder();
    type=-1;
    if ("String_Node_Str".equals(extension)) {
      FileReader fileReader=new FileReader(path);
      BufferedReader br=new BufferedReader(fileReader);
      String sCurrentLine;
      while ((sCurrentLine=br.readLine()) != null)       text.append(sCurrentLine).append('\n');
      br.close();
      type=TYPE_TXT;
      Log.d(LOGTAG,"String_Node_Str");
    }
    if ("String_Node_Str".equals(extension)) {
      Book book=(new EpubReader()).readEpub(new FileInputStream(path));
      for (      Resource res : book.getContents())       text.append(new String(res.getData()));
      text=new StringBuilder(parseEpub(text.toString()));
      type=TYPE_EPUB;
      Log.d(LOGTAG,"String_Node_Str");
    }
    this.text=text;
    textType="String_Node_Str";
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  URISyntaxException e) {
    e.printStackTrace();
  }
  if (processFailed=type == -1)   Toast.makeText(context,R.string.wrong_ext,Toast.LENGTH_SHORT).show();
 else {
    rowData=takeRowData(context);
    if (rowData != null)     position=rowData.getPosition();
  }
}
Program: 134636
Project: 134636
Buggy source:
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestSettingsText();
    readable.setText(context.getResources().getString(R.string.sample_text));
  }
 else {
    if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(Constants.PREF_CACHE,true))     intentPath=null;
switch (intentType) {
case TYPE_CLIPBOARD:
      readable=new ClipboardReadable();
    break;
case TYPE_FILE:
  readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) readable=new HtmlReadable(link);
 else throw new IllegalArgumentException("String_Node_Str");
}
readable.setPath(intentPath);
}
return readable;
}

Fixed version (ground truth):
public static Readable newInstance(Context context,Integer intentType,String intentText,String intentPath){
  Readable readable;
  if (TextUtils.isEmpty(intentText)) {
    readable=new TestSettingsText();
    readable.setText(context.getResources().getString(R.string.sample_text));
  }
 else {
    if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(Constants.PREF_CACHE,true))     intentPath=null;
switch (intentType) {
case TYPE_CLIPBOARD:
      readable=new ClipboardReadable();
    break;
case TYPE_FILE:
  readable=new FileReadable();
break;
case TYPE_TXT:
readable=new FileReadable();
break;
case TYPE_EPUB:
readable=new FileReadable();
break;
default :
String link;
if (intentText.length() < Constants.NON_LINK_LENGTH && !TextUtils.isEmpty(link=TextParser.findLink(TextParser.compilePattern(),intentText))) readable=new NetReadable(link);
 else throw new IllegalArgumentException("String_Node_Str");
}
readable.setPath(intentPath);
}
return readable;
}
Program: 134637
Project: 134637
Buggy source:
public Readable(){
  text=new StringBuilder();
  wordList=new ArrayList<String>();
  delayList=new ArrayList<Integer>();
  emphasisList=new ArrayList<Integer>();
  timeSuffixSum=new ArrayList<Integer>();
}

Fixed version (ground truth):
public Readable(){
  text=new StringBuilder();
  wordList=new ArrayList<String>();
  delayList=new ArrayList<Integer>();
  emphasisList=new ArrayList<Integer>();
  timeSuffixSum=new ArrayList<Integer>();
  rowData=new DataBundle();
  processFailed=false;
}
Program: 134639
Project: 134639
Buggy source:
@Override protected void serializeRequest(ServiceRequest request,SOAPElement soapRequest,SOAPEnvelope envelope) throws SOAPException {
  SOAPElement soapRequestOrg=soapRequest;
  soapRequest=SOAPHelper.xmlStrToSOAPElement("String_Node_Str" + Constants.PARAM_ENCRYPTION_WRAPPER + "String_Node_Str");
  try {
    Encrypter symmetricEncrypter=RESTGatewayUtil.createSymmetricEncrypter(this.keyLength);
    handleBody(request,soapRequest);
    if (this.requestBody != null && !this.requestBody.isEmpty()) {
      handleAttachment(request,soapRequest,envelope,symmetricEncrypter.encrypt(this.requestBody));
    }
    String encryptedData=symmetricEncrypter.encrypt(SOAPHelper.toString(soapRequest));
    RESTGatewayUtil.buildEncryptedBody(symmetricEncrypter,asymmetricEncrypter,soapRequestOrg,encryptedData);
  }
 catch (  NoSuchAlgorithmException ex) {
    logger.error(ex.getMessage(),ex);
    throw new SOAPException("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
@Override protected void serializeRequest(ServiceRequest request,SOAPElement soapRequest,SOAPEnvelope envelope) throws SOAPException {
  SOAPElement payload=SOAPHelper.xmlStrToSOAPElement("String_Node_Str" + Constants.PARAM_ENCRYPTION_WRAPPER + "String_Node_Str");
  try {
    Encrypter symmetricEncrypter=RESTGatewayUtil.createSymmetricEncrypter(this.keyLength);
    handleBody(request,payload);
    if (this.requestBody != null && !this.requestBody.isEmpty()) {
      handleAttachment(request,payload,envelope,symmetricEncrypter.encrypt(this.requestBody));
    }
    String encryptedData=symmetricEncrypter.encrypt(SOAPHelper.toString(payload));
    RESTGatewayUtil.buildEncryptedBody(symmetricEncrypter,asymmetricEncrypter,soapRequest,encryptedData);
  }
 catch (  NoSuchAlgorithmException ex) {
    logger.error(ex.getMessage(),ex);
    throw new SOAPException("String_Node_Str",ex);
  }
}
Program: 134640
Project: 134640
Buggy source:
@Override public void serializeResponse(ServiceResponse response,SOAPElement soapResponse,SOAPEnvelope envelope) throws SOAPException {
  SOAPElement soapResponseOrg=soapResponse;
  soapResponse=SOAPHelper.xmlStrToSOAPElement("String_Node_Str" + Constants.PARAM_ENCRYPTION_WRAPPER + "String_Node_Str");
  try {
    Encrypter symmetricEncrypter=RESTGatewayUtil.createSymmetricEncrypter(this.keyLength);
    if (this.contentType == null) {
      handleBody(response,soapResponse,envelope);
    }
 else {
      String plainText=(String)response.getResponseData();
      response.setResponseData(symmetricEncrypter.encrypt(plainText));
      handleAttachment(response,soapResponse,envelope);
    }
    logger.info("String_Node_Str",SOAPHelper.toString(soapResponse).hashCode());
    String encryptedData=symmetricEncrypter.encrypt(SOAPHelper.toString(soapResponse));
    logger.info("String_Node_Str",encryptedData.hashCode());
    RESTGatewayUtil.buildEncryptedBody(symmetricEncrypter,asymmetricEncrypter,soapResponseOrg,encryptedData);
  }
 catch (  NoSuchAlgorithmException ex) {
    logger.error(ex.getMessage(),ex);
    throw new SOAPException("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
@Override public void serializeResponse(ServiceResponse response,SOAPElement soapResponse,SOAPEnvelope envelope) throws SOAPException {
  SOAPElement payload=SOAPHelper.xmlStrToSOAPElement("String_Node_Str" + Constants.PARAM_ENCRYPTION_WRAPPER + "String_Node_Str");
  try {
    Encrypter symmetricEncrypter=RESTGatewayUtil.createSymmetricEncrypter(this.keyLength);
    if (this.contentType == null) {
      handleBody(response,payload,envelope);
    }
 else {
      String plainText=(String)response.getResponseData();
      response.setResponseData(symmetricEncrypter.encrypt(plainText));
      handleAttachment(response,payload,envelope);
    }
    logger.info("String_Node_Str",SOAPHelper.toString(payload).hashCode());
    String encryptedData=symmetricEncrypter.encrypt(SOAPHelper.toString(payload));
    logger.info("String_Node_Str",encryptedData.hashCode());
    RESTGatewayUtil.buildEncryptedBody(symmetricEncrypter,asymmetricEncrypter,soapResponse,encryptedData);
  }
 catch (  NoSuchAlgorithmException ex) {
    logger.error(ex.getMessage(),ex);
    throw new SOAPException("String_Node_Str",ex);
  }
}
Program: 134641
Project: 134641
Buggy source:
/** 
 * Returns an encrypter using the public key matching the given service id.
 * @param publicKeyFile path to public key file
 * @param publicKeyFilePassword public key file password
 * @param serviceId unique ID of the service
 * @return public key matching the given service id
 */
public static Encrypter getEncrypter(String publicKeyFile,String publicKeyFilePassword,String serviceId){
  try {
    Encrypter encrypter=new AsymmetricEncrypter(publicKeyFile,publicKeyFilePassword,serviceId);
    logger.info("String_Node_Str",serviceId);
    return encrypter;
  }
 catch (  KeyStoreException|IOException|NoSuchAlgorithmException|CertificateException ex) {
    logger.error(ex.getMessage(),ex);
    logger.debug(Constants.LOG_STRING_FOR_SETTINGS,Constants.ENCRYPTION_PROPS_PUBLIC_KEY_FILE,publicKeyFile);
    logger.debug(Constants.LOG_STRING_FOR_SETTINGS,Constants.ENCRYPTION_PROPS_PUBLIC_KEY_FILE_PASSWORD,publicKeyFilePassword.replaceAll("String_Node_Str","String_Node_Str"));
    logger.debug("String_Node_Str",serviceId);
    return null;
  }
catch (  java.lang.NullPointerException ex) {
    logger.error("String_Node_Str",serviceId);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns an encrypter using the public key matching the given service id.
 * @param publicKeyFile path to public key file
 * @param publicKeyFilePassword public key file password
 * @param serviceId unique ID of the service
 * @return public key matching the given service id
 */
public static Encrypter getEncrypter(String publicKeyFile,String publicKeyFilePassword,String serviceId){
  try {
    Encrypter encrypter=new AsymmetricEncrypter(publicKeyFile,publicKeyFilePassword,serviceId);
    logger.info("String_Node_Str",serviceId);
    return encrypter;
  }
 catch (  KeyStoreException|IOException|NoSuchAlgorithmException|CertificateException ex) {
    logger.error(ex.getMessage(),ex);
    logger.debug(Constants.LOG_STRING_FOR_SETTINGS,Constants.ENCRYPTION_PROPS_PUBLIC_KEY_FILE,publicKeyFile);
    logger.debug(Constants.LOG_STRING_FOR_SETTINGS,Constants.ENCRYPTION_PROPS_PUBLIC_KEY_FILE_PASSWORD,publicKeyFilePassword.replaceAll("String_Node_Str","String_Node_Str"));
    logger.debug("String_Node_Str",serviceId);
    return null;
  }
catch (  java.lang.NullPointerException ex) {
    logger.error("String_Node_Str",serviceId);
    logger.error(ex.getMessage(),ex);
    return null;
  }
}
Program: 134642
Project: 134642
Buggy source:
/** 
 * Generates a unique identifier if the given message id is null. Otherwise returns the given message id.
 * @param messageId message id to be checked
 * @return unique identifier if the given message id is null; otherwisemessageId
 */
private String processMessageId(String messageId){
  if (messageId == null) {
    logger.debug("String_Node_Str",Constants.XRD_HEADER_MESSAGE_ID,messageId);
    return MessageHelper.generateId();
  }
  return messageId;
}

Fixed version (ground truth):
/** 
 * Generates a unique identifier if the given message id is null. Otherwise returns the given message id.
 * @param messageId message id to be checked
 * @return unique identifier if the given message id is null; otherwisemessageId
 */
private String processMessageId(String messageId){
  if (messageId == null) {
    String id=MessageHelper.generateId();
    logger.debug("String_Node_Str",Constants.XRD_HEADER_MESSAGE_ID,id);
    return id;
  }
  return messageId;
}
Program: 134644
Project: 134644
Buggy source:
@Override protected void serializeRequest(ServiceRequest request,SOAPElement soapRequest,SOAPEnvelope envelope) throws SOAPException {
  if (this.resourceId != null && !this.resourceId.isEmpty()) {
    logger.debug("String_Node_Str",this.resourceId);
    soapRequest.addChildElement("String_Node_Str").addTextNode(this.resourceId);
  }
  Map<String,String[]> params=(Map<String,String[]>)request.getRequestData();
  for (  String key : params.keySet()) {
    String[] arr=params.get(key);
    for (    String value : arr) {
      logger.debug("String_Node_Str",key,value);
      soapRequest.addChildElement(key).addTextNode(value);
    }
  }
  if (this.requestBody != null && !this.requestBody.isEmpty()) {
    logger.debug("String_Node_Str",this.contentType);
    SOAPElement data=soapRequest.addChildElement(envelope.createName(Constants.PARAM_REQUEST_BODY));
    data.addAttribute(envelope.createName("String_Node_Str"),Constants.PARAM_REQUEST_BODY);
    AttachmentPart attachPart=request.getSoapMessage().createAttachmentPart(this.requestBody,this.contentType);
    attachPart.setContentId(Constants.PARAM_REQUEST_BODY);
    request.getSoapMessage().addAttachmentPart(attachPart);
  }
}

Fixed version (ground truth):
@Override protected void serializeRequest(ServiceRequest request,SOAPElement soapRequest,SOAPEnvelope envelope) throws SOAPException {
  if (this.resourceId != null && !this.resourceId.isEmpty()) {
    logger.debug("String_Node_Str",this.resourceId);
    soapRequest.addChildElement("String_Node_Str").addTextNode(this.resourceId);
  }
  Map<String,String[]> params=(Map<String,String[]>)request.getRequestData();
  for (  Map.Entry<String,String[]> entry : params.entrySet()) {
    String key=entry.getKey();
    String[] arr=entry.getValue();
    for (    String value : arr) {
      logger.debug("String_Node_Str",key,value);
      soapRequest.addChildElement(key).addTextNode(value);
    }
  }
  if (this.requestBody != null && !this.requestBody.isEmpty()) {
    logger.debug("String_Node_Str",this.contentType);
    SOAPElement data=soapRequest.addChildElement(envelope.createName(Constants.PARAM_REQUEST_BODY));
    data.addAttribute(envelope.createName("String_Node_Str"),Constants.PARAM_REQUEST_BODY);
    AttachmentPart attachPart=request.getSoapMessage().createAttachmentPart(this.requestBody,this.contentType);
    attachPart.setContentId(Constants.PARAM_REQUEST_BODY);
    request.getSoapMessage().addAttachmentPart(attachPart);
  }
}
Program: 134645
Project: 134645
Buggy source:
/** 
 * Reads the request body from the request and returns it as a String.
 * @param request HttpServletRequest that contains the request body
 * @return request body as a String or null
 */
private String readRequestBody(HttpServletRequest request){
  try {
    StringBuilder buffer=new StringBuilder();
    BufferedReader reader=request.getReader();
    String line;
    while ((line=reader.readLine()) != null) {
      buffer.append(line);
    }
    return buffer.toString();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Reads the request body from the request and returns it as a String.
 * @param request HttpServletRequest that contains the request body
 * @return request body as a String or null
 */
private String readRequestBody(HttpServletRequest request){
  try {
    StringBuilder buffer=new StringBuilder();
    BufferedReader reader=request.getReader();
    String line;
    while ((line=reader.readLine()) != null) {
      buffer.append(line);
    }
    return buffer.toString();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  return null;
}
Program: 134647
Project: 134647
Buggy source:
@Override public void doFilter(ServletRequest req,ServletResponse res,FilterChain fc) throws IOException, ServletException {
  HttpServletRequest request=(HttpServletRequest)req;
  String servletName="String_Node_Str";
  String oldURI=request.getRequestURI().substring(request.getContextPath().length() + 1);
  logger.debug("String_Node_Str",oldURI);
  if (oldURI.length() > servletName.length()) {
    String resourcePath=oldURI.substring(oldURI.indexOf("String_Node_Str"));
    if (!resourcePath.equals("String_Node_Str")) {
      if (!resourcePath.endsWith("String_Node_Str")) {
        resourcePath+="String_Node_Str";
      }
      logger.debug("String_Node_Str",resourcePath);
      request.setAttribute("String_Node_Str",resourcePath);
    }
 else {
      logger.trace("String_Node_Str",resourcePath);
    }
  }
 else {
    logger.trace("String_Node_Str");
  }
  req.getRequestDispatcher("String_Node_Str").forward(req,res);
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest req,ServletResponse res,FilterChain fc) throws IOException, ServletException {
  HttpServletRequest request=(HttpServletRequest)req;
  String servletName="String_Node_Str";
  String oldURI=request.getRequestURI().substring(request.getContextPath().length() + 1);
  logger.debug("String_Node_Str",oldURI);
  if (oldURI.length() > servletName.length()) {
    String resourcePath=oldURI.substring(oldURI.indexOf('/'));
    if (!"String_Node_Str".equals(resourcePath)) {
      if (!resourcePath.endsWith("String_Node_Str")) {
        resourcePath+="String_Node_Str";
      }
      logger.debug("String_Node_Str",resourcePath);
      request.setAttribute("String_Node_Str",resourcePath);
    }
 else {
      logger.trace("String_Node_Str",resourcePath);
    }
  }
 else {
    logger.trace("String_Node_Str");
  }
  req.getRequestDispatcher("String_Node_Str").forward(req,res);
}
Program: 134648
Project: 134648
Buggy source:
/** 
 * Goes through the given endpoint and tries to find an endpoint which id matches the given service id. If no match is found, then tries to find a partial match.
 * @param serviceId service id to be looked for
 * @param endpoints list of endpoints
 * @return endpoint matching the given service id or null
 */
public static ConsumerEndpoint findMatch(String serviceId,Map<String,ConsumerEndpoint> endpoints){
  if (endpoints.containsKey(serviceId)) {
    logger.debug("String_Node_Str",serviceId);
    return endpoints.get(serviceId);
  }
  for (  String key : endpoints.keySet()) {
    String keyMod=key.replaceAll("String_Node_Str" + Constants.PARAM_RESOURCE_ID + "String_Node_Str","String_Node_Str");
    logger.trace("String_Node_Str",keyMod);
    if (serviceId.matches(keyMod)) {
      logger.debug("String_Node_Str",serviceId,key);
      ConsumerEndpoint endpoint=endpoints.get(key);
      int index=key.indexOf("String_Node_Str");
      if (index != -1) {
        String resourceId=serviceId.substring(index);
        if (resourceId.endsWith("String_Node_Str")) {
          resourceId=resourceId.substring(0,resourceId.length() - 1);
        }
        endpoint.setResourceId(resourceId);
        logger.trace("String_Node_Str",resourceId);
      }
      return endpoint;
    }
  }
  logger.debug("String_Node_Str",serviceId);
  return null;
}

Fixed version (ground truth):
/** 
 * Goes through the given endpoint and tries to find an endpoint which id matches the given service id. If no match is found, then tries to find a partial match.
 * @param serviceId service id to be looked for
 * @param endpoints list of endpoints
 * @return endpoint matching the given service id or null
 */
public static ConsumerEndpoint findMatch(String serviceId,Map<String,ConsumerEndpoint> endpoints){
  if (endpoints.containsKey(serviceId)) {
    logger.debug("String_Node_Str",serviceId);
    return endpoints.get(serviceId);
  }
  for (  Map.Entry<String,ConsumerEndpoint> entry : endpoints.entrySet()) {
    String key=entry.getKey();
    String keyMod=key.replaceAll("String_Node_Str" + Constants.PARAM_RESOURCE_ID + "String_Node_Str","String_Node_Str");
    logger.trace("String_Node_Str",keyMod);
    if (serviceId.matches(keyMod)) {
      logger.debug("String_Node_Str",serviceId,key);
      ConsumerEndpoint endpoint=entry.getValue();
      int index=key.indexOf('{');
      if (index != -1) {
        String resourceId=serviceId.substring(index);
        if (resourceId.endsWith("String_Node_Str")) {
          resourceId=resourceId.substring(0,resourceId.length() - 1);
        }
        endpoint.setResourceId(resourceId);
        logger.trace("String_Node_Str",resourceId);
      }
      return endpoint;
    }
  }
  logger.debug("String_Node_Str",serviceId);
  return null;
}
Program: 134649
Project: 134649
Buggy source:
/** 
 * Rewrites all the URLs in the responseStr that are matching the resourcePath to point the Consumer Gateway servlet.
 * @param servletUrl URL of Consumer Gateway serlvet
 * @param resourcePath path that's rewritten to point the Consumer Gateway
 * @param responseStr response to be modified
 * @return modified response
 */
public static String rewriteUrl(String servletUrl,String resourcePath,String responseStr){
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str",servletUrl);
  try {
    resourcePath=resourcePath.substring(1,resourcePath.length() - 1).replaceAll("String_Node_Str" + Constants.PARAM_RESOURCE_ID + "String_Node_Str","String_Node_Str");
    logger.debug("String_Node_Str",resourcePath);
    logger.debug("String_Node_Str",servletUrl,resourcePath);
    return responseStr.replaceAll("String_Node_Str" + resourcePath,servletUrl + resourcePath);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str");
    logger.error(ex.getMessage(),ex);
    return responseStr;
  }
}

Fixed version (ground truth):
/** 
 * Rewrites all the URLs in the responseStr that are matching the resourcePath to point the Consumer Gateway servlet.
 * @param servletUrl URL of Consumer Gateway serlvet
 * @param pathToResource path that's rewritten to point the Consumer Gateway
 * @param responseStr response to be modified
 * @return modified response
 */
public static String rewriteUrl(String servletUrl,String pathToResource,String responseStr){
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str",servletUrl);
  try {
    String resourcePath=pathToResource.substring(1,pathToResource.length() - 1).replaceAll("String_Node_Str" + Constants.PARAM_RESOURCE_ID + "String_Node_Str","String_Node_Str");
    logger.debug("String_Node_Str",resourcePath);
    logger.debug("String_Node_Str",servletUrl,resourcePath);
    return responseStr.replaceAll("String_Node_Str" + resourcePath,servletUrl + resourcePath);
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str");
    logger.error(ex.getMessage(),ex);
    return responseStr;
  }
}
Program: 134650
Project: 134650
Buggy source:
/** 
 * Removes response tag and its namespace prefixes from the given response message. All the response tag's namespace prefixes are removed from the children. Response tag can be simple <response> or prefixed with service name <serviceNameResponse>.
 * @param message response message
 * @return children of the response tag
 */
public static String removeResponseTag(String message){
  String responsePrefix="String_Node_Str";
  String regex="String_Node_Str";
  Pattern pattern=Pattern.compile(regex);
  Matcher matcher=pattern.matcher(message);
  if (matcher.find()) {
    if (matcher.group(1) != null) {
      responsePrefix=matcher.group(1);
      logger.debug("String_Node_Str",responsePrefix);
    }
 else {
      logger.debug("String_Node_Str");
    }
  }
  String response=message.replaceAll("String_Node_Str" + responsePrefix + "String_Node_Str","String_Node_Str");
  if (!responsePrefix.isEmpty()) {
    response=response.replaceAll("String_Node_Str" + responsePrefix,"String_Node_Str");
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Removes response tag and its namespace prefixes from the given response message. All the response tag's namespace prefixes are removed from the children. Response tag can be simple \<response\> or prefixed with service name \<serviceNameResponse\>.
 * @param message response message
 * @return children of the response tag
 */
public static String removeResponseTag(String message){
  String responsePrefix="String_Node_Str";
  String regex="String_Node_Str";
  Pattern pattern=Pattern.compile(regex);
  Matcher matcher=pattern.matcher(message);
  if (matcher.find()) {
    if (matcher.group(1) != null) {
      responsePrefix=matcher.group(1);
      logger.debug("String_Node_Str",responsePrefix);
    }
 else {
      logger.debug("String_Node_Str");
    }
  }
  String response=message.replaceAll("String_Node_Str" + responsePrefix + "String_Node_Str","String_Node_Str");
  if (!responsePrefix.isEmpty()) {
    response=response.replaceAll("String_Node_Str" + responsePrefix,"String_Node_Str");
  }
  return response;
}