nus-yam/ex-repair huggingface dataset:
Program: 186219
Project: 186219
Buggy source:
public RemoteViews updateEventEntry(String packageName,EventEntry event){
  RemoteViews rv=new RemoteViews(packageName,getEventEntryLayout());
  Intent intent=CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId());
  rv.setOnClickFillInIntent(R.id.event_entry_text_layout,intent);
  rv.setOnClickFillInIntent(R.id.event_entry_color,intent);
  rv.setOnClickFillInIntent(R.id.event_entry_title,intent);
  rv.setTextViewText(R.id.event_entry_title,event.getTitle());
  if (event.isAllDay()) {
    rv.setViewVisibility(R.id.event_entry_date,View.GONE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_date,View.VISIBLE);
    rv.setOnClickFillInIntent(R.id.event_entry_date,intent);
    rv.setTextViewText(R.id.event_entry_date,createTimeString(event.getStartDate()) + SPACED_DASH + createTimeString(event.getEndDate()));
  }
  if (event.isAlarmActive() && prefs.getBoolean(PREF_INDICATE_ALERTS,true)) {
    rv.setViewVisibility(R.id.event_entry_indicator_alarm,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_indicator_alarm,View.GONE);
  }
  if (event.isRecurring() && prefs.getBoolean(PREF_INDICATE_RECURRING,false)) {
    rv.setViewVisibility(R.id.event_entry_indicator_recurring,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_indicator_recurring,View.GONE);
  }
  rv.setInt(R.id.event_entry_color,METHOD_SET_BACKGROUND_COLOR,event.getColor());
  return rv;
}

Fixed version (ground truth):
public RemoteViews updateEventEntry(String packageName,EventEntry event){
  RemoteViews rv=new RemoteViews(packageName,getEventEntryLayout());
  Intent intent=CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId(),event.getStartDate(),event.getEndDate());
  rv.setOnClickFillInIntent(R.id.event_entry_text_layout,intent);
  rv.setOnClickFillInIntent(R.id.event_entry_color,intent);
  rv.setOnClickFillInIntent(R.id.event_entry_title,intent);
  rv.setTextViewText(R.id.event_entry_title,event.getTitle());
  if (event.isAllDay()) {
    rv.setViewVisibility(R.id.event_entry_date,View.GONE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_date,View.VISIBLE);
    rv.setOnClickFillInIntent(R.id.event_entry_date,intent);
    rv.setTextViewText(R.id.event_entry_date,createTimeString(event.getStartDate()) + SPACED_DASH + createTimeString(event.getEndDate()));
  }
  if (event.isAlarmActive() && prefs.getBoolean(PREF_INDICATE_ALERTS,true)) {
    rv.setViewVisibility(R.id.event_entry_indicator_alarm,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_indicator_alarm,View.GONE);
  }
  if (event.isRecurring() && prefs.getBoolean(PREF_INDICATE_RECURRING,false)) {
    rv.setViewVisibility(R.id.event_entry_indicator_recurring,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.event_entry_indicator_recurring,View.GONE);
  }
  rv.setInt(R.id.event_entry_color,METHOD_SET_BACKGROUND_COLOR,event.getColor());
  return rv;
}
Program: 186220
Project: 186220
Buggy source:
public CalendarEntry cloneAsSpanningEvent(CalendarEntry eventEntry,long startDate,long endDate){
  CalendarEntry spanningEvent=eventEntry.clone();
  spanningEvent.setStartDate(startDate);
  spanningEvent.setEndDate(endDate);
  spanningEvent.setSpansMultipleDays(true);
  return spanningEvent;
}

Fixed version (ground truth):
public CalendarEntry cloneAsSpanningEvent(CalendarEntry eventEntry,long startDate,long endDate){
  CalendarEntry clone=eventEntry.clone();
  clone.setStartDate(startDate);
  clone.setEndDate(endDate);
  clone.setSpansMultipleDays(true);
  clone.setOriginalEvent(eventEntry);
  return clone;
}
Program: 186221
Project: 186221
Buggy source:
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysCovered=eventEntry.daysCovered();
  if (eventEntry.getStartDate() >= today) {
    if (daysCovered > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(today + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}

Fixed version (ground truth):
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysCovered=eventEntry.daysCovered();
  if (eventEntry.getStartDate() >= today) {
    if (daysCovered > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(today + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(eventEntry);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}
Program: 186222
Project: 186222
Buggy source:
public Intent createOnItemClickIntent(CalendarEntry event){
  return CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId(),event.getStartDate(),event.getEndDate());
}

Fixed version (ground truth):
public Intent createOnItemClickIntent(CalendarEntry event){
  CalendarEntry originalEvent=event.getOriginalEvent();
  if (originalEvent != null) {
    event=originalEvent;
  }
  return CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId(),event.getStartDate(),event.getEndDate());
}
Program: 186223
Project: 186223
Buggy source:
private Option<View> setupView(final View view){
  AdView adView;
  try {
    adView=(AdView)view;
  }
 catch (  ClassCastException err) {
    adView=null;
    Crashlytics.logException(err);
  }
  if (adView != null) {
    final AdRequest adRequest=new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    adView.loadAd(adRequest);
    return Option.some(adView);
  }
  return Option.none();
}

Fixed version (ground truth):
private Option<View> setupView(final View view){
  AdView adView;
  try {
    adView=(AdView)view;
  }
 catch (  ClassCastException err) {
    adView=null;
    Crashlytics.logException(err);
  }
  if (adView != null) {
    final AdRequest adRequest=new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    try {
      adView.loadAd(adRequest);
    }
 catch (    OutOfMemoryError err) {
      return Option.none();
    }
    return Option.some(adView);
  }
  return Option.none();
}
Program: 186224
Project: 186224
Buggy source:
/** 
 * Workaround for Android KitKat where the we might take the place of a default app for http/https which we really fucking don't want to be.
 * @return whether the Url has been handled by this
 */
private boolean handleUnknownUrl(){
  if (Build.VERSION.SDK_INT != Build.VERSION_CODES.KITKAT) {
    return false;
  }
  Ln.i("String_Node_Str");
  final Intent intent=Intent.createChooser(getIntent(),null);
  intent.setAction(Intent.ACTION_VIEW);
  getPackageManager().clearPackagePreferredActivities(getPackageName());
  try {
    startActivity(intent);
    finish();
  }
 catch (  ActivityNotFoundException err) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Workaround for Android KitKat where the we might take the place of a default app for http/https which we really fucking don't want to be.
 * @return whether the Url has been handled by this
 */
private boolean handleUnknownUrl(){
  if (Build.VERSION.SDK_INT != Build.VERSION_CODES.KITKAT) {
    return false;
  }
  Ln.i("String_Node_Str");
  final Intent intent=Intent.createChooser(getIntent(),null);
  intent.setAction(Intent.ACTION_VIEW);
  try {
    startActivity(intent);
    finish();
  }
 catch (  ActivityNotFoundException err) {
    return false;
  }
  return true;
}
Program: 186225
Project: 186225
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  mIsPostSaveInstanceState=true;
  super.onSaveInstanceState(outState);
  outState.putParcelable(MEDIA_STATE_TAG,mMediaState);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putParcelable(MEDIA_STATE_TAG,mMediaState);
}
Program: 186226
Project: 186226
Buggy source:
public boolean isPurchasable(){
  return purchaseUrl != null;
}

Fixed version (ground truth):
public boolean isPurchasable(){
  if (purchaseUrl != null) {
    final String lowerUrl=purchaseUrl.toLowerCase();
    return lowerUrl.startsWith("String_Node_Str") || lowerUrl.startsWith("String_Node_Str");
  }
  return false;
}
Program: 186227
Project: 186227
Buggy source:
public String getPurchaseUrl(){
  return purchaseUrl;
}

Fixed version (ground truth):
public String getPurchaseUrl(){
  return purchaseUrl.toLowerCase();
}
Program: 186228
Project: 186228
Buggy source:
private void startPurchase(){
  Uri uri=Uri.parse(mTrack.getPurchaseUrl().toLowerCase());
  final Intent intent=new Intent(Intent.ACTION_VIEW,uri);
  startActivity(intent);
  mTrackerProvider.get().sendEvent(ANALYTICS_TAG,"String_Node_Str",uri.toString(),mTrack.getId());
}

Fixed version (ground truth):
private void startPurchase(){
  Uri uri=Uri.parse(mTrack.getPurchaseUrl());
  final Intent intent=new Intent(Intent.ACTION_VIEW,uri);
  startActivity(intent);
  mTrackerProvider.get().sendEvent(ANALYTICS_TAG,"String_Node_Str",uri.toString(),mTrack.getId());
}
Program: 186229
Project: 186229
Buggy source:
public SpecifierTree EXPORT_SPECIFIER(){
  return b.<SpecifierTree>nonterminal(Kind.EXPORT_SPECIFIER).is(b.firstOf(f.exportSpecifier(IDENTIFIER_REFERENCE(),b.token(EcmaScriptLexer.AS),IDENTIFIER_NAME()),f.exportSpecifier(IDENTIFIER_REFERENCE())));
}

Fixed version (ground truth):
public SpecifierTree EXPORT_SPECIFIER(){
  return b.<SpecifierTree>nonterminal(Kind.EXPORT_SPECIFIER).is(b.firstOf(f.exportSpecifier(f.identifierReference(b.token(JavaScriptKeyword.DEFAULT)),b.token(EcmaScriptLexer.AS),IDENTIFIER_NAME()),f.exportSpecifier(f.identifierReference(b.token(JavaScriptKeyword.DEFAULT))),f.exportSpecifier(IDENTIFIER_REFERENCE(),b.token(EcmaScriptLexer.AS),IDENTIFIER_NAME()),f.exportSpecifier(IDENTIFIER_REFERENCE())));
}
Program: 186230
Project: 186230
Buggy source:
public VueElement VUE_ELEMENT(){
  return b.<VueElement>nonterminal().is(b.firstOf(f.vueElement(b.token(EcmaScriptLexer.VUE_TEMPLATE_SECTION)),f.vueElement(b.token(EcmaScriptLexer.VUE_STYLE_SECTION)),f.scriptVueElement(b.token(EcmaScriptLexer.SCRIPT_TAG),b.optional(b.token(EcmaScriptLexer.SHEBANG)),b.optional(MODULE_BODY()),b.token(EcmaScriptLexer.SCRIPT_TAG_CLOSE))));
}

Fixed version (ground truth):
public VueElement VUE_ELEMENT(){
  return b.<VueElement>nonterminal().is(b.firstOf(f.vueElement(b.token(EcmaScriptLexer.VUE_TEMPLATE_SECTION)),f.vueElement(b.token(EcmaScriptLexer.VUE_STYLE_SECTION)),f.scriptVueElement(VUE_SCRIPT_TAG(),b.optional(b.token(EcmaScriptLexer.SHEBANG)),b.optional(MODULE_BODY()),b.token(EcmaScriptLexer.SCRIPT_TAG_CLOSE))));
}
Program: 186231
Project: 186231
Buggy source:
public ScriptVueElement scriptVueElement(InternalSyntaxToken scriptOpenTag,Optional<InternalSyntaxToken> shebangToken,Optional<ModuleTree> items,InternalSyntaxToken scriptCloseTag){
  return new ScriptVueElement(shebangToken.orNull(),items.orNull());
}

Fixed version (ground truth):
public ScriptVueElement scriptVueElement(VueScriptTag scriptOpenTag,Optional<InternalSyntaxToken> shebangToken,Optional<ModuleTree> items,InternalSyntaxToken scriptCloseTag){
  return new ScriptVueElement(shebangToken.orNull(),items.orNull());
}
Program: 186232
Project: 186232
Buggy source:
@Test public void vue_file() throws Exception {
  final String styleWithCss="String_Node_Str";
  final String componentTemplate="String_Node_Str";
  final String componentTemplateWithScript="String_Node_Str";
  assertThat(EcmaScriptLexer.VUE_SCRIPT).matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches(componentTemplateWithScript + "String_Node_Str" + styleWithCss).matches(componentTemplate + "String_Node_Str" + styleWithCss).matches(componentTemplate + styleWithCss + "String_Node_Str").matches("String_Node_Str" + componentTemplate + styleWithCss).matches("String_Node_Str" + styleWithCss + componentTemplate).matches(styleWithCss + "String_Node_Str" + componentTemplate).matches(styleWithCss + componentTemplate + "String_Node_Str");
}

Fixed version (ground truth):
@Test public void vue_file() throws Exception {
  final String styleWithCss="String_Node_Str";
  final String componentTemplate="String_Node_Str";
  final String componentTemplateWithScript="String_Node_Str";
  assertThat(EcmaScriptLexer.VUE_SCRIPT).matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches("String_Node_Str").matches(componentTemplateWithScript + "String_Node_Str" + styleWithCss).matches(componentTemplate + "String_Node_Str" + styleWithCss).matches(componentTemplate + styleWithCss + "String_Node_Str").matches("String_Node_Str" + componentTemplate + styleWithCss).matches("String_Node_Str" + styleWithCss + componentTemplate).matches(styleWithCss + "String_Node_Str" + componentTemplate).matches(styleWithCss + componentTemplate + "String_Node_Str");
}
Program: 186233
Project: 186233
Buggy source:
public ExpressionTree ASSIGNMENT_EXPRESSION(){
  return b.<ExpressionTree>nonterminal(EcmaScriptLexer.ASSIGNMENT_EXPRESSION).is(b.firstOf(f.assignmentWithArrayDestructuring(ARRAY_ASSIGNMENT_PATTERN(),b.token(JavaScriptPunctuator.EQU),ASSIGNMENT_EXPRESSION()),f.assignmentExpression(b.firstOf(OBJECT_ASSIGNMENT_PATTERN(),LEFT_HAND_SIDE_EXPRESSION()),b.firstOf(b.token(JavaScriptPunctuator.EQU),b.token(JavaScriptPunctuator.STAR_EQU),b.token(JavaScriptPunctuator.EXP_EQU),b.token(JavaScriptPunctuator.DIV_EQU),b.token(JavaScriptPunctuator.MOD_EQU),b.token(JavaScriptPunctuator.PLUS_EQU),b.token(JavaScriptPunctuator.MINUS_EQU),b.token(JavaScriptPunctuator.SL_EQU),b.token(JavaScriptPunctuator.SR_EQU),b.token(JavaScriptPunctuator.SR_EQU2),b.token(JavaScriptPunctuator.AND_EQU),b.token(JavaScriptPunctuator.XOR_EQU),b.token(JavaScriptPunctuator.OR_EQU)),ASSIGNMENT_EXPRESSION()),YIELD_EXPRESSION(),ARROW_FUNCTION(),CONDITIONAL_EXPRESSION_NOT_ES6_ASSIGNMENT_EXPRESSION()));
}

Fixed version (ground truth):
public ExpressionTree ASSIGNMENT_EXPRESSION(){
  return b.<ExpressionTree>nonterminal(EcmaScriptLexer.ASSIGNMENT_EXPRESSION).is(b.firstOf(f.assignmentWithArrayDestructuring(ARRAY_ASSIGNMENT_PATTERN(),b.token(JavaScriptPunctuator.EQU),ASSIGNMENT_EXPRESSION()),f.assignmentExpression(b.firstOf(OBJECT_ASSIGNMENT_PATTERN(),LEFT_HAND_SIDE_EXPRESSION()),ASSIGNMENT_TOKEN(),ASSIGNMENT_EXPRESSION()),YIELD_EXPRESSION(),ARROW_FUNCTION(),CONDITIONAL_EXPRESSION()));
}
Program: 186234
Project: 186234
Buggy source:
public ExpressionTree CONDITIONAL_EXPRESSION(){
  return b.<ExpressionTree>nonterminal(Kind.CONDITIONAL_EXPRESSION).is(f.optionalConditionalExpression(CONDITIONAL_OR_EXPRESSION(),b.optional(f.conditionalExpressionTail(b.token(JavaScriptPunctuator.QUERY),ASSIGNMENT_EXPRESSION(),b.token(JavaScriptPunctuator.COLON),ASSIGNMENT_EXPRESSION()))));
}

Fixed version (ground truth):
public ExpressionTree CONDITIONAL_EXPRESSION(){
  return b.<ExpressionTree>nonterminal(Kind.CONDITIONAL_EXPRESSION).is(f.optionalConditionalExpression(CONDITIONAL_OR_EXPRESSION(),b.optional(CONDITIONAL_EXPRESSION_TAIL())));
}
Program: 186235
Project: 186235
Buggy source:
@Override public void startOfFile(ScriptTree scriptTree){
  ignoredList.clear();
}

Fixed version (ground truth):
@Override protected void startOfFile(ScriptTree scriptTree){
  ignoredList.clear();
}
Program: 186236
Project: 186236
Buggy source:
@Override public void startOfFile(ScriptTree scriptTree){
  alwaysTrueConditions.clear();
  fileLoops=FileLoops.create(scriptTree);
}

Fixed version (ground truth):
@Override protected void startOfFile(ScriptTree scriptTree){
  alwaysTrueConditions.clear();
  fileLoops=FileLoops.create(scriptTree);
}
Program: 186237
Project: 186237
Buggy source:
public void startOfFile(ScriptTree scriptTree){
}

Fixed version (ground truth):
/** 
 * Override this method to perform actions before any analysis is performed
 * @param scriptTree the scriptTree that is going to be analyzed
 */
protected void startOfFile(ScriptTree scriptTree){
}
Program: 186238
Project: 186238
Buggy source:
@Override public void visitNode(Tree tree){
  if (tree.is(Kind.SCRIPT)) {
    checks.forEach(seCheck -> seCheck.startOfFile((ScriptTree)tree));
    return;
  }
  FunctionTree functionTree=(FunctionTree)tree;
  if (functionTree.body().is(Kind.BLOCK)) {
    ControlFlowGraph cfg=ControlFlowGraph.build((BlockTree)functionTree.body());
    Scope functionScope=getContext().getSymbolModel().getScope(functionTree);
    new SymbolicExecution(functionScope,cfg,checks).visitCfg(ProgramState.emptyState());
  }
}

Fixed version (ground truth):
@Override public void visitNode(Tree tree){
  if (tree.is(Kind.SCRIPT)) {
    checks.forEach(seCheck -> seCheck.cleanupAndStartFileAnalysis((ScriptTree)tree));
    return;
  }
  FunctionTree functionTree=(FunctionTree)tree;
  if (functionTree.body().is(Kind.BLOCK)) {
    ControlFlowGraph cfg=ControlFlowGraph.build((BlockTree)functionTree.body());
    Scope functionScope=getContext().getSymbolModel().getScope(functionTree);
    new SymbolicExecution(functionScope,cfg,checks).visitCfg(ProgramState.emptyState());
  }
}
Program: 186239
Project: 186239
Buggy source:
@Override public void endOfExecution(Scope functionScope){
  for (  Entry<Tree,Optional<String>> entry : hasIssue.entrySet()) {
    if (entry.getValue().isPresent()) {
      addIssue(entry.getKey(),entry.getValue().get());
    }
  }
}

Fixed version (ground truth):
@Override public void endOfExecution(Scope functionScope){
  for (  Entry<Tree,Optional<String>> entry : hasIssue.entrySet()) {
    Optional<String> value=entry.getValue();
    if (value.isPresent()) {
      addIssue(entry.getKey(),value.get());
    }
  }
}
Program: 186240
Project: 186240
Buggy source:
private static boolean isUpdateOnOneWithAssign(ExpressionTree update){
  if (update.is(PLUS_ASSIGNMENT,Tree.Kind.MINUS_ASSIGNMENT)) {
    ExpressionTree rightExpression=((AssignmentExpressionTree)update).expression();
    return rightExpression.is(Tree.Kind.NUMERIC_LITERAL) && "String_Node_Str".equals(((LiteralTree)rightExpression).value());
  }
  return false;
}

Fixed version (ground truth):
private static boolean isUpdateOnOneWithAssign(ExpressionTree update){
  if (update.is(PLUS_ASSIGNMENT,MINUS_ASSIGNMENT)) {
    ExpressionTree rightExpression=((AssignmentExpressionTree)update).expression();
    return rightExpression.is(NUMERIC_LITERAL) && "String_Node_Str".equals(((LiteralTree)rightExpression).value());
  }
  return false;
}
Program: 186241
Project: 186241
Buggy source:
private static void counters(ExpressionTree update,Set<String> counters){
  ExpressionTree counter=null;
  if (update.is(Tree.Kind.COMMA_OPERATOR)) {
    BinaryExpressionTree commaExpressions=(BinaryExpressionTree)update;
    counters(commaExpressions.leftOperand(),counters);
    counters(commaExpressions.rightOperand(),counters);
  }
 else   if (update.is(KindSet.INC_DEC_KINDS)) {
    counter=((UnaryExpressionTree)update).expression();
  }
 else   if (update.is(PLUS_ASSIGNMENT,Kind.MINUS_ASSIGNMENT)) {
    counter=((AssignmentExpressionTree)update).variable();
  }
  if (counter != null && counter.is(Kind.IDENTIFIER_REFERENCE)) {
    counters.add(((IdentifierTree)counter).name());
  }
}

Fixed version (ground truth):
private static void counters(ExpressionTree update,Set<String> counters){
  ExpressionTree counter=null;
  if (update.is(COMMA_OPERATOR)) {
    BinaryExpressionTree commaExpressions=(BinaryExpressionTree)update;
    counters(commaExpressions.leftOperand(),counters);
    counters(commaExpressions.rightOperand(),counters);
  }
 else   if (update.is(INC_DEC_KINDS)) {
    counter=((UnaryExpressionTree)update).expression();
  }
 else   if (update.is(PLUS_ASSIGNMENT,MINUS_ASSIGNMENT)) {
    counter=((AssignmentExpressionTree)update).variable();
  }
  if (counter != null && counter.is(IDENTIFIER_REFERENCE)) {
    counters.add(((IdentifierTree)counter).name());
  }
}
Program: 186242
Project: 186242
Buggy source:
private static boolean isTrivialIteratorException(ForStatementTree forStatement){
  ExpressionTree condition=forStatement.condition();
  if (condition != null && condition.is(Tree.Kind.NOT_EQUAL_TO)) {
    ExpressionTree update=forStatement.update();
    Tree init=forStatement.init();
    if (init != null && update != null) {
      return checkForTrivialIteratorException(init,condition,update);
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean isTrivialIteratorException(ForStatementTree forStatement){
  ExpressionTree condition=forStatement.condition();
  if (condition != null && condition.is(NOT_EQUAL_TO)) {
    ExpressionTree update=forStatement.update();
    Tree init=forStatement.init();
    if (init != null && update != null) {
      return checkForTrivialIteratorException(init,condition,update);
    }
  }
  return false;
}
Program: 186243
Project: 186243
Buggy source:
private static Integer getInteger(ExpressionTree expression){
  if (expression.is(Tree.Kind.NUMERIC_LITERAL)) {
    LiteralTree literal=(LiteralTree)expression;
    Integer decoded;
    try {
      decoded=Integer.decode(literal.value());
      return decoded;
    }
 catch (    NumberFormatException e) {
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
private static Integer getInteger(ExpressionTree expression){
  if (expression.is(NUMERIC_LITERAL)) {
    LiteralTree literal=(LiteralTree)expression;
    Integer decoded;
    try {
      decoded=Integer.decode(literal.value());
      return decoded;
    }
 catch (    NumberFormatException e) {
      return null;
    }
  }
  return null;
}
Program: 186244
Project: 186244
Buggy source:
private static boolean isNontrivialConditionException(ForStatementTree forStatement){
  ExpressionTree condition=forStatement.condition();
  ExpressionTree update=forStatement.update();
  if (update != null && condition != null && condition.is(Kind.EQUAL_TO,Kind.NOT_EQUAL_TO,Kind.STRICT_EQUAL_TO,Kind.STRICT_NOT_EQUAL_TO)) {
    Set<String> counters=new HashSet<>();
    counters(update,counters);
    ExpressionTree leftOperand=((BinaryExpressionTree)condition).leftOperand();
    return !leftOperand.is(Kind.IDENTIFIER_REFERENCE) || !counters.contains(((IdentifierTree)leftOperand).name());
  }
  return false;
}

Fixed version (ground truth):
private static boolean isNontrivialConditionException(ForStatementTree forStatement){
  ExpressionTree condition=forStatement.condition();
  ExpressionTree update=forStatement.update();
  if (update != null && condition != null && condition.is(EQUAL_TO,NOT_EQUAL_TO,STRICT_EQUAL_TO,STRICT_NOT_EQUAL_TO)) {
    Set<String> counters=new HashSet<>();
    counters(update,counters);
    ExpressionTree leftOperand=((BinaryExpressionTree)condition).leftOperand();
    return !leftOperand.is(IDENTIFIER_REFERENCE) || !counters.contains(((IdentifierTree)leftOperand).name());
  }
  return false;
}
Program: 186245
Project: 186245
Buggy source:
private static boolean isUpdateIncDec(ExpressionTree update){
  boolean result=false;
  if (update.is(Tree.Kind.COMMA_OPERATOR)) {
    BinaryExpressionTree commaExpressions=(BinaryExpressionTree)update;
    result=isUpdateIncDec(commaExpressions.leftOperand()) && isUpdateIncDec(commaExpressions.rightOperand());
  }
 else   if (update.is(KindSet.INC_DEC_KINDS) || update.is(PLUS_ASSIGNMENT,MINUS_ASSIGNMENT)) {
    result=true;
  }
  return result;
}

Fixed version (ground truth):
private static boolean isUpdateIncDec(ExpressionTree update){
  boolean result=false;
  if (update.is(COMMA_OPERATOR)) {
    BinaryExpressionTree commaExpressions=(BinaryExpressionTree)update;
    result=isUpdateIncDec(commaExpressions.leftOperand()) && isUpdateIncDec(commaExpressions.rightOperand());
  }
 else   if (update.is(INC_DEC_KINDS) || update.is(PLUS_ASSIGNMENT,MINUS_ASSIGNMENT)) {
    result=true;
  }
  return result;
}
Program: 186246
Project: 186246
Buggy source:
@Nullable private static Integer getValue(Tree tree){
  Integer result=null;
  if (tree.is(Tree.Kind.NOT_EQUAL_TO)) {
    result=getInteger(((BinaryExpressionTree)tree).rightOperand());
  }
 else   if (isOneVarDeclaration(tree)) {
    BindingElementTree variable=((VariableDeclarationTree)tree).variables().get(0);
    if (variable.is(Tree.Kind.INITIALIZED_BINDING_ELEMENT)) {
      result=getInteger(((InitializedBindingElementTree)variable).right());
    }
  }
 else   if (tree.is(Tree.Kind.ASSIGNMENT)) {
    result=getInteger(((AssignmentExpressionTree)tree).expression());
  }
  return result;
}

Fixed version (ground truth):
@Nullable private static Integer getValue(Tree tree){
  Integer result=null;
  if (tree.is(NOT_EQUAL_TO)) {
    result=getInteger(((BinaryExpressionTree)tree).rightOperand());
  }
 else   if (isOneVarDeclaration(tree)) {
    BindingElementTree variable=((VariableDeclarationTree)tree).variables().get(0);
    if (variable.is(INITIALIZED_BINDING_ELEMENT)) {
      result=getInteger(((InitializedBindingElementTree)variable).right());
    }
  }
 else   if (tree.is(ASSIGNMENT)) {
    result=getInteger(((AssignmentExpressionTree)tree).expression());
  }
  return result;
}
Program: 186247
Project: 186247
Buggy source:
private static boolean isOneVarDeclaration(Tree tree){
  return tree.is(Tree.Kind.VAR_DECLARATION) && ((VariableDeclarationTree)tree).variables().size() == 1;
}

Fixed version (ground truth):
private static boolean isOneVarDeclaration(Tree tree){
  return tree.is(VAR_DECLARATION) && ((VariableDeclarationTree)tree).variables().size() == 1;
}
Program: 186248
Project: 186248
Buggy source:
private static int checkForUpdateByOne(ExpressionTree update){
  if (update.is(Tree.Kind.POSTFIX_INCREMENT,Tree.Kind.PREFIX_INCREMENT) || (update.is(PLUS_ASSIGNMENT) && isUpdateOnOneWithAssign(update))) {
    return +1;
  }
  if (update.is(Tree.Kind.POSTFIX_DECREMENT,Tree.Kind.PREFIX_DECREMENT) || (update.is(Tree.Kind.MINUS_ASSIGNMENT) && isUpdateOnOneWithAssign(update))) {
    return -1;
  }
  return 0;
}

Fixed version (ground truth):
private static int checkForUpdateByOne(ExpressionTree update){
  if (update.is(POSTFIX_INCREMENT,PREFIX_INCREMENT) || (update.is(PLUS_ASSIGNMENT) && isUpdateOnOneWithAssign(update))) {
    return +1;
  }
  if (update.is(POSTFIX_DECREMENT,PREFIX_DECREMENT) || (update.is(MINUS_ASSIGNMENT) && isUpdateOnOneWithAssign(update))) {
    return -1;
  }
  return 0;
}
Program: 186249
Project: 186249
Buggy source:
private static boolean isEquality(ExpressionTree condition){
  return condition.is(Tree.Kind.EQUAL_TO,Tree.Kind.NOT_EQUAL_TO);
}

Fixed version (ground truth):
private static boolean isEquality(ExpressionTree condition){
  return condition.is(EQUAL_TO,NOT_EQUAL_TO);
}
Program: 186250
Project: 186250
Buggy source:
private static int consumeEscapeSequence(int i,int len,String value,StringBuilder escapeSequence,StringBuilder result){
  while (escapeSequence.length() != len && i < value.length()) {
    i++;
    escapeSequence.append(value.charAt(i));
  }
  if (escapeSequence.length() == len) {
    result.append((char)Integer.parseInt(escapeSequence.toString(),16));
    escapeSequence.setLength(0);
  }
  i++;
  return i;
}

Fixed version (ground truth):
private static int consumeEscapeSequence(int i,int len,String value,StringBuilder escapeSequence,StringBuilder result){
  int ii=i;
  while (escapeSequence.length() != len && ii < value.length()) {
    ii++;
    escapeSequence.append(value.charAt(ii));
  }
  if (escapeSequence.length() == len) {
    result.append((char)Integer.parseInt(escapeSequence.toString(),16));
    escapeSequence.setLength(0);
  }
  ii++;
  return ii;
}
Program: 186251
Project: 186251
Buggy source:
private void buildUsagesAndLivenesses(ControlFlowGraph cfg,Usages usages,Set<BlockLiveness> livenesses){
  livenessPerBlock=new HashMap<>();
  for (  CfgBlock block : cfg.blocks()) {
    BlockLiveness blockLiveness=new BlockLiveness(block,usages);
    livenessPerBlock.put(block,blockLiveness);
    livenesses.add(blockLiveness);
  }
  Deque<CfgBlock> queue=new ArrayDeque(cfg.blocks());
  while (!queue.isEmpty()) {
    CfgBlock block=queue.pop();
    BlockLiveness blockLiveness=livenessPerBlock.get(block);
    boolean changed=blockLiveness.updateLiveInAndOut(livenessPerBlock);
    if (changed) {
      block.predecessors().forEach(queue::push);
    }
  }
}

Fixed version (ground truth):
private void buildUsagesAndLivenesses(ControlFlowGraph cfg,Usages usages,Set<BlockLiveness> livenesses){
  livenessPerBlock=new HashMap<>();
  for (  CfgBlock block : cfg.blocks()) {
    BlockLiveness blockLiveness=new BlockLiveness(block,usages);
    livenessPerBlock.put(block,blockLiveness);
    livenesses.add(blockLiveness);
  }
  Deque<CfgBlock> queue=new ArrayDeque<>(cfg.blocks());
  while (!queue.isEmpty()) {
    CfgBlock block=queue.pop();
    BlockLiveness blockLiveness=livenessPerBlock.get(block);
    boolean changed=blockLiveness.updateLiveInAndOut(livenessPerBlock);
    if (changed) {
      block.predecessors().forEach(queue::push);
    }
  }
}
Program: 186252
Project: 186252
Buggy source:
public GlobalVariableNames(@Nullable Settings settings){
  ImmutableSet.Builder<String> namesBuilder=ImmutableSet.builder();
  namesBuilder.addAll(globalsFromEnvironment("String_Node_Str").get());
  if (settings != null) {
    namesBuilder.add(settings.getStringArray(GLOBALS_PROPERTY_KEY));
    for (    String environmentName : settings.getStringArray(ENVIRONMENTS_PROPERTY_KEY)) {
      Optional<Set<String>> namesFromCurrentEnvironment=globalsFromEnvironment(environmentName);
      if (namesFromCurrentEnvironment.isPresent()) {
        namesBuilder.addAll(namesFromCurrentEnvironment.get());
      }
 else {
        LOGGER.warn(ENVIRONMENTS_PROPERTY_KEY + "String_Node_Str" + environmentName);
      }
    }
  }
  this.names=namesBuilder.build();
}

Fixed version (ground truth):
public GlobalVariableNames(@Nullable Settings settings){
  ImmutableSet.Builder<String> namesBuilder=ImmutableSet.builder();
  if (globalsFromEnvironment("String_Node_Str").isPresent()) {
    namesBuilder.addAll(globalsFromEnvironment("String_Node_Str").get());
  }
  if (settings != null) {
    namesBuilder.add(settings.getStringArray(GLOBALS_PROPERTY_KEY));
    for (    String environmentName : settings.getStringArray(ENVIRONMENTS_PROPERTY_KEY)) {
      Optional<Set<String>> namesFromCurrentEnvironment=globalsFromEnvironment(environmentName);
      if (namesFromCurrentEnvironment.isPresent()) {
        namesBuilder.addAll(namesFromCurrentEnvironment.get());
      }
 else {
        LOGGER.warn(ENVIRONMENTS_PROPERTY_KEY + "String_Node_Str" + environmentName);
      }
    }
  }
  this.names=namesBuilder.build();
}
Program: 186253
Project: 186253
Buggy source:
@Override public void visitFunctionDeclaration(FunctionDeclarationTree tree){
  IdentifierTree name=tree.name();
  Preconditions.checkState(name.symbol() != null,"String_Node_Str",name.name(),((JavaScriptTree)tree).getLine());
  name.symbol().addType(FunctionType.create(tree));
  super.visitFunctionDeclaration(tree);
}

Fixed version (ground truth):
@Override public void visitFunctionDeclaration(FunctionDeclarationTree tree){
  IdentifierTree name=tree.name();
  String nameName=name.name();
  Preconditions.checkState(name.symbol() != null,"String_Node_Str",nameName,((JavaScriptTree)tree).getLine());
  name.symbol().addType(FunctionType.create(tree));
  super.visitFunctionDeclaration(tree);
}
Program: 186254
Project: 186254
Buggy source:
/** 
 * Parse the given string and return the first descendant of the given kind.
 * @param s                  the string to parse
 * @param descendantToReturn the node kind to seek in the generated tree
 * @return the node found for the given kind, null if not found.
 */
protected <T extends Tree>T parse(String s,Kind descendantToReturn) throws Exception {
  Tree node=p.parse(s);
  checkFullFidelity(node,s);
  return (T)getFirstDescendant((JavaScriptTree)node,descendantToReturn);
}

Fixed version (ground truth):
/** 
 * Parse the given string and return the first descendant of the given kind.
 * @param s                  the string to parse
 * @param descendantToReturn the node kind to seek in the generated tree
 * @return the node found for the given kind, null if not found.
 */
@SuppressWarnings("String_Node_Str") protected <T extends Tree>T parse(String s,Kind descendantToReturn) throws Exception {
  Tree node=p.parse(s);
  checkFullFidelity(node,s);
  return (T)getFirstDescendant((JavaScriptTree)node,descendantToReturn);
}
Program: 186255
Project: 186255
Buggy source:
public void visitCommaOperatorExpression(Tree expression){
  if (expression == null) {
    return;
  }
  if (expression.is(Kind.COMMA_OPERATOR)) {
    visitCommaOperatorExpression(((BinaryExpressionTree)expression).leftOperand());
    visitCommaOperatorExpression(((BinaryExpressionTree)expression).rightOperand());
  }
 else   if (expression instanceof AssignmentExpressionTree) {
    super.visitAssignmentExpression((AssignmentExpressionTree)expression);
  }
 else {
    scan(expression);
  }
}

Fixed version (ground truth):
public void visitCommaOperatorExpression(@Nullable Tree expression){
  if (expression == null) {
    return;
  }
  if (expression.is(Kind.COMMA_OPERATOR)) {
    visitCommaOperatorExpression(((BinaryExpressionTree)expression).leftOperand());
    visitCommaOperatorExpression(((BinaryExpressionTree)expression).rightOperand());
  }
 else   if (expression instanceof AssignmentExpressionTree) {
    super.visitAssignmentExpression((AssignmentExpressionTree)expression);
  }
 else {
    scan(expression);
  }
}
Program: 186256
Project: 186256
Buggy source:
private void except(Tree tree){
  if (tree != null && tree.is(Tree.Kind.EMPTY_STATEMENT)) {
    exceptedStatements.add((EmptyStatementTree)tree);
  }
}

Fixed version (ground truth):
private void except(Tree tree){
  if (tree.is(Tree.Kind.EMPTY_STATEMENT)) {
    exceptedStatements.add((EmptyStatementTree)tree);
  }
}
Program: 186257
Project: 186257
Buggy source:
private static List<ExpressionTree> updatedExpressions(ExpressionTree expression){
  if (expression == null) {
    return ImmutableList.<ExpressionTree>of();
  }
  UpdateVisitor visitor=new UpdateVisitor();
  expression.accept(visitor);
  return visitor.updatedExpressions;
}

Fixed version (ground truth):
private static List<ExpressionTree> updatedExpressions(@Nullable ExpressionTree expression){
  if (expression == null) {
    return ImmutableList.<ExpressionTree>of();
  }
  UpdateVisitor visitor=new UpdateVisitor();
  expression.accept(visitor);
  return visitor.updatedExpressions;
}
Program: 186258
Project: 186258
Buggy source:
private void increaseNumberOfJumpInScopes(SyntaxToken jump,IdentifierTree label){
  for (  JumpTarget jumpTarget : jumpTargets) {
    String labelName=label == null ? null : label.name();
    jumpTarget.jumps.add(jump);
    if (Objects.equal(labelName,jumpTarget.label)) {
      break;
    }
  }
}

Fixed version (ground truth):
private void increaseNumberOfJumpInScopes(SyntaxToken jump,@Nullable IdentifierTree label){
  for (  JumpTarget jumpTarget : jumpTargets) {
    String labelName=label == null ? null : label.name();
    jumpTarget.jumps.add(jump);
    if (Objects.equal(labelName,jumpTarget.label)) {
      break;
    }
  }
}
Program: 186259
Project: 186259
Buggy source:
public JsCfgBranchingBlock(Tree branchingTree,JsCfgBlock trueSuccessor,JsCfgBlock falseSuccessor){
  Preconditions.checkArgument(branchingTree != null,"String_Node_Str");
  Preconditions.checkArgument(trueSuccessor != null && falseSuccessor != null,"String_Node_Str");
  this.trueSuccessor=trueSuccessor;
  this.falseSuccessor=falseSuccessor;
  this.branchingTree=branchingTree;
}

Fixed version (ground truth):
public JsCfgBranchingBlock(Tree branchingTree,JsCfgBlock trueSuccessor,JsCfgBlock falseSuccessor){
  this.trueSuccessor=trueSuccessor;
  this.falseSuccessor=falseSuccessor;
  this.branchingTree=branchingTree;
}
Program: 186260
Project: 186260
Buggy source:
private ProgramState executeInitializedBinding(InitializedBindingElementTree initializedBindingElementTree,ProgramState programState){
  ProgramState newProgramState=programState;
  if (((JavaScriptTree)initializedBindingElementTree).getParent().is(Kind.OBJECT_BINDING_PATTERN,Kind.ARRAY_BINDING_PATTERN)) {
    newProgramState=programState.removeLastValue();
  }
 else {
    BindingElementTree variable=initializedBindingElementTree.left();
    if (variable.is(Kind.BINDING_IDENTIFIER)) {
      newProgramState=assignment(programState,variable);
    }
    newProgramState=newProgramState.clearStack(initializedBindingElementTree);
  }
  return newProgramState;
}

Fixed version (ground truth):
private ProgramState executeInitializedBinding(InitializedBindingElementTree initializedBindingElementTree,ProgramState programState){
  ProgramState newProgramState=programState;
  if (((JavaScriptTree)initializedBindingElementTree).getParent().is(Kind.OBJECT_BINDING_PATTERN,Kind.ARRAY_BINDING_PATTERN,Kind.BINDING_PROPERTY)) {
    newProgramState=programState.removeLastValue();
  }
 else {
    BindingElementTree variable=initializedBindingElementTree.left();
    if (variable.is(Kind.BINDING_IDENTIFIER)) {
      newProgramState=assignment(programState,variable);
    }
    newProgramState=newProgramState.clearStack(initializedBindingElementTree);
  }
  return newProgramState;
}
Program: 186261
Project: 186261
Buggy source:
public ExpressionTree EXPONENTIATION_EXPRESSION(){
  return b.<ExpressionTree>nonterminal().is(f.newExponentiation(b.zeroOrMore(f.newTuple31(UNARY_EXPRESSION(),b.token(JavaScriptPunctuator.EXP))),UNARY_EXPRESSION()));
}

Fixed version (ground truth):
public ExpressionTree EXPONENTIATION_EXPRESSION(){
  return b.<ExpressionTree>nonterminal().is(f.newExponentiation(UNARY_EXPRESSION(),b.zeroOrMore(f.newTuple31(b.token(JavaScriptPunctuator.EXP),UNARY_EXPRESSION()))));
}
Program: 186262
Project: 186262
Buggy source:
public ExpressionTree newExponentiation(Optional<List<Tuple<ExpressionTree,InternalSyntaxToken>>> operatorAndOperands,ExpressionTree expression){
  if (!operatorAndOperands.isPresent()) {
    return expression;
  }
  ExpressionTree result=expression;
  for (  Tuple<ExpressionTree,InternalSyntaxToken> t : Lists.reverse(operatorAndOperands.get())) {
    result=new BinaryExpressionTreeImpl(getBinaryOperator(t.second),t.first,t.second(),result);
  }
  return result;
}

Fixed version (ground truth):
public ExpressionTree newExponentiation(ExpressionTree expression,Optional<List<Tuple<InternalSyntaxToken,ExpressionTree>>> operatorAndOperands){
  if (!operatorAndOperands.isPresent()) {
    return expression;
  }
  List<Tuple<InternalSyntaxToken,ExpressionTree>> list=operatorAndOperands.get();
  ExpressionTree result=list.get(list.size() - 1).second;
  for (int i=list.size() - 1; i > 0; i--) {
    result=new BinaryExpressionTreeImpl(Kind.EXPONENT,list.get(i - 1).second,list.get(i).first,result);
  }
  return new BinaryExpressionTreeImpl(Kind.EXPONENT,expression,list.get(0).first,result);
}
Program: 186263
Project: 186263
Buggy source:
public int endLine(){
  return lastToken.line();
}

Fixed version (ground truth):
public int endLine(){
  return lastToken.line() + lastTokenLinesNumber - 1;
}
Program: 186264
Project: 186264
Buggy source:
public int endLineOffset(){
  return lastToken.column() + lastToken.text().length();
}

Fixed version (ground truth):
public int endLineOffset(){
  if (lastTokenLinesNumber == 1) {
    return lastToken.column() + lastToken.text().length();
  }
 else {
    return lastTokenLastLineLength;
  }
}
Program: 186265
Project: 186265
Buggy source:
private void checkJQueryProperty(ExpressionTree expressionTree,List<String> deprecated,String parentheses){
  if (expressionTree.is(Tree.Kind.DOT_MEMBER_EXPRESSION)) {
    ExpressionTree object=((DotMemberExpressionTreeImpl)expressionTree).object();
    ExpressionTree property=((DotMemberExpressionTreeImpl)expressionTree).property();
    if (isJQueryObject(object) && propertyIsDeprecated(property,deprecated)) {
      getContext().addIssue(this,expressionTree,String.format(MESSAGE,((IdentifierTree)property).name() + parentheses));
    }
  }
}

Fixed version (ground truth):
private void checkJQueryProperty(ExpressionTree expressionTree,List<String> deprecated,String parentheses){
  if (expressionTree.is(Tree.Kind.DOT_MEMBER_EXPRESSION)) {
    ExpressionTree object=((DotMemberExpressionTreeImpl)expressionTree).object();
    ExpressionTree property=((DotMemberExpressionTreeImpl)expressionTree).property();
    if (isJQueryObject(object) && propertyIsDeprecated(property,deprecated)) {
      getContext().addIssue(this,property,String.format(MESSAGE,((IdentifierTree)property).name() + parentheses));
    }
  }
}
Program: 186266
Project: 186266
Buggy source:
private void checkSelectorProperty(ExpressionTree expressionTree,List<String> deprecated,String parentheses){
  if (expressionTree.is(Tree.Kind.DOT_MEMBER_EXPRESSION)) {
    ExpressionTree object=((DotMemberExpressionTreeImpl)expressionTree).object();
    ExpressionTree property=((DotMemberExpressionTreeImpl)expressionTree).property();
    if (isMultiLevelSelector(object) && propertyIsDeprecated(property,deprecated)) {
      getContext().addIssue(this,expressionTree,String.format(MESSAGE,((IdentifierTree)property).name() + parentheses));
    }
  }
}

Fixed version (ground truth):
private void checkSelectorProperty(ExpressionTree expressionTree,List<String> deprecated,String parentheses){
  if (expressionTree.is(Tree.Kind.DOT_MEMBER_EXPRESSION)) {
    ExpressionTree object=((DotMemberExpressionTreeImpl)expressionTree).object();
    ExpressionTree property=((DotMemberExpressionTreeImpl)expressionTree).property();
    if (isMultiLevelSelector(object) && propertyIsDeprecated(property,deprecated)) {
      getContext().addIssue(this,property,String.format(MESSAGE,((IdentifierTree)property).name() + parentheses));
    }
  }
}
Program: 186267
Project: 186267
Buggy source:
@Test public void test(){
  DeprecatedJQueryAPICheck check=new DeprecatedJQueryAPICheck();
  SourceFile file=scanFile("String_Node_Str",check);
  CheckMessagesVerifier.verify(file.getCheckMessages()).next().atLine(1).withMessage("String_Node_Str").next().atLine(3).withMessage("String_Node_Str").next().atLine(5).withMessage("String_Node_Str").next().atLine(7).withMessage("String_Node_Str").next().atLine(9).withMessage("String_Node_Str").next().atLine(11).withMessage("String_Node_Str").noMore();
}

Fixed version (ground truth):
@Test public void test(){
  DeprecatedJQueryAPICheck check=new DeprecatedJQueryAPICheck();
  SourceFile file=scanFile("String_Node_Str",check);
  CheckMessagesVerifier.verify(file.getCheckMessages()).next().atLine(1).withMessage("String_Node_Str").next().atLine(3).withMessage("String_Node_Str").next().atLine(5).withMessage("String_Node_Str").next().atLine(7).withMessage("String_Node_Str").next().atLine(9).withMessage("String_Node_Str").next().atLine(11).withMessage("String_Node_Str").next().atLine(17).withMessage("String_Node_Str").noMore();
}
Program: 186268
Project: 186268
Buggy source:
public FileLinesVisitor(FileLinesContextFactory fileLinesContextFactory,FileSystem fileSystem){
  this.fileLinesContextFactory=fileLinesContextFactory;
  this.fileSystem=fileSystem;
}

Fixed version (ground truth):
public FileLinesVisitor(FileLinesContextFactory fileLinesContextFactory,FileSystem fileSystem,PathResolver pathResolver){
  this.fileLinesContextFactory=fileLinesContextFactory;
  this.fileSystem=fileSystem;
  this.pathResolver=pathResolver;
}
Program: 186269
Project: 186269
Buggy source:
@Override public void leaveFile(AstNode astNode){
  InputFile inputFile=fileSystem.inputFile(fileSystem.predicates().is(getContext().getFile()));
  if (inputFile != null) {
    FileLinesContext fileLinesContext=fileLinesContextFactory.createFor(inputFile);
    int fileLength=getContext().peekSourceCode().getInt(EcmaScriptMetric.LINES);
    for (int line=1; line <= fileLength; line++) {
      fileLinesContext.setIntValue(CoreMetrics.NCLOC_DATA_KEY,line,linesOfCode.contains(line) ? 1 : 0);
      fileLinesContext.setIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY,line,linesOfComments.contains(line) ? 1 : 0);
    }
    fileLinesContext.save();
  }
 else {
    LOG.warn("String_Node_Str",getContext().getFile().getName());
  }
  linesOfCode.clear();
  linesOfComments.clear();
}

Fixed version (ground truth):
@Override public void leaveFile(AstNode astNode){
  FileLinesContext fileLinesContext=fileLinesContextFactory.createFor(File.create(pathResolver.relativePath(fileSystem.baseDir(),getContext().getFile().getAbsoluteFile())));
  if (fileLinesContext != null) {
    int fileLength=getContext().peekSourceCode().getInt(EcmaScriptMetric.LINES);
    for (int line=1; line <= fileLength; line++) {
      fileLinesContext.setIntValue(CoreMetrics.NCLOC_DATA_KEY,line,linesOfCode.contains(line) ? 1 : 0);
      fileLinesContext.setIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY,line,linesOfComments.contains(line) ? 1 : 0);
    }
    fileLinesContext.save();
  }
 else {
    LOG.warn("String_Node_Str",getContext().getFile().getName());
  }
  linesOfCode.clear();
  linesOfComments.clear();
}
Program: 186270
Project: 186270
Buggy source:
@Test public void test() throws Exception {
  FileLinesContextFactory fileLinesContextFactory=mock(FileLinesContextFactory.class);
  FileLinesContext fileLinesContext=mock(FileLinesContext.class);
  when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext);
  File file=TestUtils.getResource("String_Node_Str");
  FileLinesVisitor visitor=new FileLinesVisitor(fileLinesContextFactory,newFileSystem(file));
  JavaScriptAstScanner.scanSingleFile(file,visitor);
  verify(fileLinesContext,times(3)).setIntValue(eq(CoreMetrics.NCLOC_DATA_KEY),anyInt(),eq(1));
  verify(fileLinesContext,times(1)).setIntValue(eq(CoreMetrics.COMMENT_LINES_DATA_KEY),anyInt(),eq(1));
}

Fixed version (ground truth):
@Test public void test() throws Exception {
  FileLinesContextFactory fileLinesContextFactory=mock(FileLinesContextFactory.class);
  FileLinesContext fileLinesContext=mock(FileLinesContext.class);
  when(fileLinesContextFactory.createFor(any(Resource.class))).thenReturn(fileLinesContext);
  File file=TestUtils.getResource("String_Node_Str");
  FileLinesVisitor visitor=new FileLinesVisitor(fileLinesContextFactory,newFileSystem(file),new PathResolver());
  JavaScriptAstScanner.scanSingleFile(file,visitor);
  verify(fileLinesContext,times(3)).setIntValue(eq(CoreMetrics.NCLOC_DATA_KEY),anyInt(),eq(1));
  verify(fileLinesContext,times(1)).setIntValue(eq(CoreMetrics.COMMENT_LINES_DATA_KEY),anyInt(),eq(1));
}
Program: 186271
Project: 186271
Buggy source:
private FileSystem newFileSystem(File file){
  DefaultFileSystem fs=new DefaultFileSystem();
  fs.add(new DefaultInputFile(file.getName()).setAbsolutePath(file.getAbsolutePath()).setType(InputFile.Type.MAIN));
  return fs;
}

Fixed version (ground truth):
private FileSystem newFileSystem(File file) throws URISyntaxException {
  DefaultFileSystem fs=new DefaultFileSystem();
  fs.setBaseDir(TestUtils.getResource("String_Node_Str"));
  fs.add(new DefaultInputFile(file.getName()).setAbsolutePath(file.getAbsolutePath()).setType(InputFile.Type.MAIN));
  return fs;
}