Program: 58315
Project: 58315
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  int itemType=this.getItemViewType(position);
switch (itemType) {
case ALARM_TYPE:
    AlarmStats alarm=(AlarmStats)getItem(position);
  AlarmViewHolder alarmViewHolder;
if (convertView == null) {
  alarmViewHolder=new AlarmViewHolder();
  LayoutInflater inflater=LayoutInflater.from(getContext());
  convertView=inflater.inflate(R.layout.fragment_alarms_listitem,parent,false);
  alarmViewHolder.name=(TextView)convertView.findViewById(R.id.textviewAlarmName);
  alarmViewHolder.alarmCount=(TextView)convertView.findViewById(R.id.textViewAlarmCount);
  convertView.setTag(alarmViewHolder);
}
 else {
  alarmViewHolder=(AlarmViewHolder)convertView.getTag();
}
alarmViewHolder.name.setText(alarm.getName());
alarmViewHolder.alarmCount.setText(String.valueOf(alarm.getAllowedCount()));
alarmViewHolder.name.setSelected(true);
alarmViewHolder.alarmCount.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED));
int height=alarmViewHolder.alarmCount.getMeasuredHeight();
int width=alarmViewHolder.alarmCount.getMeasuredWidth();
if (height > width) {
alarmViewHolder.alarmCount.setLayoutParams(new LinearLayout.LayoutParams(height,height));
}
 else {
alarmViewHolder.alarmCount.setLayoutParams(new LinearLayout.LayoutParams(width,width));
}
float correctedStat=alarm.getAllowedCount() - mLowCount;
float point=120 - ((correctedStat / mScale) * 120);
float[] hsv={point,1,1};
alarmViewHolder.alarmCount.setBackgroundColor(Color.HSVToColor(hsv));
break;
case CATEGORY_TYPE:
CategoryViewHolder categoryViewHolder=null;
if (convertView == null) {
categoryViewHolder=new CategoryViewHolder();
LayoutInflater inflater=LayoutInflater.from(getContext());
convertView=inflater.inflate(R.layout.fragment_wakelocks_listgroup,parent,false);
categoryViewHolder.name=(TextView)convertView.findViewById(R.id.textviewCategoryName);
convertView.setTag(categoryViewHolder);
}
 else {
categoryViewHolder=(CategoryViewHolder)convertView.getTag();
}
if (position == mCategoryBlockedIndex) {
categoryViewHolder.name.setText("String_Node_Str");
}
 else if (position == mCategorySafeIndex) {
categoryViewHolder.name.setText("String_Node_Str");
}
 else if (position == mCategoryUnknownIndex) {
categoryViewHolder.name.setText("String_Node_Str");
}
 else if (position == mCategoryUnsafeIndex) {
categoryViewHolder.name.setText("String_Node_Str");
}
 else {
categoryViewHolder.name.setText("String_Node_Str");
}
break;
}
return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  int itemType=this.getItemViewType(position);
switch (itemType) {
case ALARM_TYPE:
    AlarmStats alarm=(AlarmStats)getItem(position);
  AlarmViewHolder alarmViewHolder;
if (convertView == null) {
  alarmViewHolder=new AlarmViewHolder();
  LayoutInflater inflater=LayoutInflater.from(getContext());
  convertView=inflater.inflate(R.layout.fragment_alarms_listitem,parent,false);
  alarmViewHolder.name=(TextView)convertView.findViewById(R.id.textviewAlarmName);
  alarmViewHolder.alarmCount=(TextView)convertView.findViewById(R.id.textViewAlarmCount);
  convertView.setTag(alarmViewHolder);
}
 else {
  alarmViewHolder=(AlarmViewHolder)convertView.getTag();
}
alarmViewHolder.name.setText(alarm.getName());
alarmViewHolder.alarmCount.setText(String.valueOf(alarm.getAllowedCount()));
alarmViewHolder.name.setSelected(true);
alarmViewHolder.alarmCount.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED));
int height=alarmViewHolder.alarmCount.getMeasuredHeight();
int width=alarmViewHolder.alarmCount.getMeasuredWidth();
if (height > width) {
alarmViewHolder.alarmCount.setLayoutParams(new LinearLayout.LayoutParams(height,height));
}
 else {
alarmViewHolder.alarmCount.setLayoutParams(new LinearLayout.LayoutParams(width,width));
}
float correctedStat=alarm.getAllowedCount() - mLowCount;
float point=120 - ((correctedStat / mScale) * 120);
float[] hsv={point,1,1};
alarmViewHolder.alarmCount.setBackgroundColor(Color.HSVToColor(hsv));
break;
case CATEGORY_TYPE:
CategoryViewHolder categoryViewHolder=null;
if (convertView == null) {
categoryViewHolder=new CategoryViewHolder();
LayoutInflater inflater=LayoutInflater.from(getContext());
convertView=inflater.inflate(R.layout.fragment_wakelocks_listgroup,parent,false);
categoryViewHolder.name=(TextView)convertView.findViewById(R.id.textviewCategoryName);
convertView.setTag(categoryViewHolder);
}
 else {
categoryViewHolder=(CategoryViewHolder)convertView.getTag();
}
if (position == mCategoryBlockedIndex) {
categoryViewHolder.name.setText(R.string.category_unbounced);
}
 else if (position == mCategorySafeIndex) {
categoryViewHolder.name.setText(R.string.category_safe);
}
 else if (position == mCategoryUnknownIndex) {
categoryViewHolder.name.setText(R.string.category_unknown);
}
 else if (position == mCategoryUnsafeIndex) {
categoryViewHolder.name.setText(R.string.category_not_safe);
}
 else {
categoryViewHolder.name.setText(R.string.category_error);
}
break;
}
return convertView;
}