Program: 13467
Project: 13467
Buggy source:
public static String getPublishedEndpointPeriodDateParameters(StatsTimeframe timeframe,String date){
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return null;
  }
  try {
    SimpleDateFormat sdf=new SimpleDateFormat(StatsConstants.STATS_INPUT_DATE_FORMAT);
    Calendar c=Calendar.getInstance();
    c.setFirstDayOfWeek(Calendar.MONDAY);
    Date parsedDate=sdf.parse(date);
    c.setTime(parsedDate);
    final String after;
    final String before;
switch (timeframe) {
case DAY:
      after=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
    c.add(Calendar.DAY_OF_YEAR,+1);
  before=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case WEEK:
c.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
after=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case MONTH:
c.set(Calendar.DAY_OF_MONTH,c.getActualMaximum(Calendar.DAY_OF_MONTH));
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.setTime(parsedDate);
c.set(Calendar.DAY_OF_MONTH,c.getActualMinimum(Calendar.DAY_OF_MONTH));
after=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case YEAR:
c.set(Calendar.MONTH,Calendar.DECEMBER);
c.set(Calendar.DAY_OF_MONTH,31);
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.setTime(parsedDate);
c.set(Calendar.MONTH,Calendar.JANUARY);
c.set(Calendar.DAY_OF_MONTH,1);
after=StatsUtils.msToString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
default :
AppLog.w(AppLog.T.STATS,"String_Node_Str");
return null;
}
return "String_Node_Str" + after + "String_Node_Str"+ before;
}
 catch (ParseException e) {
AppLog.e(AppLog.T.UTILS,e);
return null;
}
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") public static String getPublishedEndpointPeriodDateParameters(StatsTimeframe timeframe,String date){
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return null;
  }
  try {
    SimpleDateFormat sdf=new SimpleDateFormat(StatsConstants.STATS_INPUT_DATE_FORMAT);
    Calendar c=Calendar.getInstance();
    c.setFirstDayOfWeek(Calendar.MONDAY);
    Date parsedDate=sdf.parse(date);
    c.setTime(parsedDate);
    final String after;
    final String before;
switch (timeframe) {
case DAY:
      after=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
    c.add(Calendar.DAY_OF_YEAR,+1);
  before=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case WEEK:
c.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
after=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case MONTH:
c.set(Calendar.DAY_OF_MONTH,c.getActualMaximum(Calendar.DAY_OF_MONTH));
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.setTime(parsedDate);
c.set(Calendar.DAY_OF_MONTH,c.getActualMinimum(Calendar.DAY_OF_MONTH));
after=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
case YEAR:
c.set(Calendar.MONTH,Calendar.DECEMBER);
c.set(Calendar.DAY_OF_MONTH,31);
c.add(Calendar.DAY_OF_YEAR,+1);
before=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
c.setTime(parsedDate);
c.set(Calendar.MONTH,Calendar.JANUARY);
c.set(Calendar.DAY_OF_MONTH,1);
after=StatsUtils.msToLocalizedString(c.getTimeInMillis(),StatsConstants.STATS_INPUT_DATE_FORMAT);
break;
default :
AppLog.w(AppLog.T.STATS,"String_Node_Str");
return null;
}
return "String_Node_Str" + after + "String_Node_Str"+ before;
}
 catch (ParseException e) {
AppLog.e(AppLog.T.UTILS,e);
return null;
}
}