Program: 88759
Project: 88759
Buggy source:
public View getView(final int position,View convertView,final ViewGroup parent){
  final ViewHolder holder;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=mLayoutInflater.inflate(R.layout.traitline,null);
    holder.name=(TextView)convertView.findViewById(R.id.text1);
    holder.format=(TextView)convertView.findViewById(R.id.text2);
    holder.visible=(CheckBox)convertView.findViewById(R.id.visible);
    holder.dragSort=(ImageView)convertView.findViewById(R.id.dragSort);
    holder.menuPopup=(ImageView)convertView.findViewById(R.id.popupMenu);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  convertView.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  holder.id=getItem(position).id;
  holder.realPosition=getItem(position).realPosition;
  holder.name.setText(getItem(position).trait);
  holder.format.setText(getItem(position).format);
  if (visibility != null) {
    if (visibility.get(holder.name.getText().toString()) != null) {
      if (visibility.get(holder.name.getText().toString()).equals("String_Node_Str")) {
        holder.visible.setChecked(true);
      }
 else       holder.visible.setChecked(false);
    }
  }
  holder.visible.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton arg0,    boolean position){
      if (holder.visible.isChecked()) {
        MainActivity.dt.updateTraitVisibility(holder.name.getText().toString(),true);
      }
 else {
        MainActivity.dt.updateTraitVisibility(holder.name.getText().toString(),false);
      }
      TraitEditorActivity.loadData();
      MainActivity.reloadData=true;
    }
  }
);
  holder.dragSort.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        DragSortListView drag=(DragSortListView)parent;
        drag.startDrag(position,DragSortListView.DRAG_POS_Y | DragSortListView.DRAG_NEG_Y,0,0);
        Log.w("String_Node_Str","String_Node_Str");
        return true;
      }
 else       if (event.getAction() == MotionEvent.ACTION_UP) {
        DragSortListView drag=(DragSortListView)parent;
        drag.stopDrag(false);
        Log.w("String_Node_Str","String_Node_Str");
        return true;
      }
 else       return false;
    }
  }
);
  holder.menuPopup.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      PopupMenu popup=new PopupMenu(TraitEditorActivity.thisActivity,v);
      popup.getMenuInflater().inflate(R.menu.traititemmenu,popup.getMenu());
      popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        public boolean onMenuItemClick(        MenuItem item){
          if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.copy))) {
            int pos=MainActivity.dt.getMaxPositionFromTraits() + 1;
            String traitName=getItem(position).trait;
            if (traitName.contains("String_Node_Str")) {
              traitName=traitName.substring(0,traitName.indexOf("String_Node_Str"));
            }
            String newTraitName="String_Node_Str";
            String[] allTraits=MainActivity.dt.getAllTraits();
            for (int i=0; i < allTraits.length; i++) {
              newTraitName=traitName + "String_Node_Str" + "String_Node_Str"+ Integer.toString(i)+ "String_Node_Str";
              if (!Arrays.asList(allTraits).contains(newTraitName)) {
                break;
              }
            }
            MainActivity.dt.insertTraits(newTraitName,getItem(position).format,getItem(position).defaultValue,getItem(position).minimum,getItem(position).maximum,getItem(position).details,getItem(position).categories,"String_Node_Str",String.valueOf(pos));
            TraitEditorActivity.loadData();
            MainActivity.reloadData=true;
          }
 else           if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.delete))) {
            AlertDialog.Builder builder=new AlertDialog.Builder(context);
            builder.setTitle(context.getString(R.string.deletetrait));
            builder.setMessage(context.getString(R.string.areyousure));
            builder.setPositiveButton(context.getString(R.string.yes),new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int which){
                dialog.dismiss();
                MainActivity.dt.deleteTrait(holder.id);
                TraitEditorActivity.loadData();
                MainActivity.reloadData=true;
              }
            }
);
            builder.setNegativeButton(context.getString(R.string.no),new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int which){
                dialog.dismiss();
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
 else           if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.edit))) {
            listener.onItemClick((AdapterView)parent,v,position,v.getId());
          }
          return false;
        }
      }
);
      popup.show();
    }
  }
);
  return convertView;
}

Fixed version (ground truth):
public View getView(final int position,View convertView,final ViewGroup parent){
  final ViewHolder holder;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=mLayoutInflater.inflate(R.layout.traitline,null);
    holder.name=(TextView)convertView.findViewById(R.id.text1);
    holder.format=(TextView)convertView.findViewById(R.id.text2);
    holder.visible=(CheckBox)convertView.findViewById(R.id.visible);
    holder.dragSort=(ImageView)convertView.findViewById(R.id.dragSort);
    holder.menuPopup=(ImageView)convertView.findViewById(R.id.popupMenu);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  convertView.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
    }
  }
);
  holder.id=getItem(position).id;
  holder.realPosition=getItem(position).realPosition;
  holder.name.setText(getItem(position).trait);
  holder.format.setText(getItem(position).format);
  if (visibility != null) {
    if (visibility.get(holder.name.getText().toString()) != null) {
      if (visibility.get(holder.name.getText().toString()).equals("String_Node_Str")) {
        holder.visible.setChecked(true);
      }
 else       holder.visible.setChecked(false);
    }
  }
  holder.visible.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton arg0,    boolean position){
      if (holder.visible.isChecked()) {
        MainActivity.dt.updateTraitVisibility(holder.name.getText().toString(),true);
      }
 else {
        MainActivity.dt.updateTraitVisibility(holder.name.getText().toString(),false);
      }
    }
  }
);
  holder.dragSort.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        DragSortListView drag=(DragSortListView)parent;
        drag.startDrag(position,DragSortListView.DRAG_POS_Y | DragSortListView.DRAG_NEG_Y,0,0);
        Log.w("String_Node_Str","String_Node_Str");
        return true;
      }
 else       if (event.getAction() == MotionEvent.ACTION_UP) {
        DragSortListView drag=(DragSortListView)parent;
        drag.stopDrag(false);
        TraitEditorActivity.loadData();
        MainActivity.reloadData=true;
        Log.w("String_Node_Str","String_Node_Str");
        return true;
      }
 else       return false;
    }
  }
);
  holder.menuPopup.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      PopupMenu popup=new PopupMenu(TraitEditorActivity.thisActivity,v);
      popup.getMenuInflater().inflate(R.menu.traititemmenu,popup.getMenu());
      popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        public boolean onMenuItemClick(        MenuItem item){
          if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.copy))) {
            int pos=MainActivity.dt.getMaxPositionFromTraits() + 1;
            String traitName=getItem(position).trait;
            if (traitName.contains("String_Node_Str")) {
              traitName=traitName.substring(0,traitName.indexOf("String_Node_Str"));
            }
            String newTraitName="String_Node_Str";
            String[] allTraits=MainActivity.dt.getAllTraits();
            for (int i=0; i < allTraits.length; i++) {
              newTraitName=traitName + "String_Node_Str" + "String_Node_Str"+ Integer.toString(i)+ "String_Node_Str";
              if (!Arrays.asList(allTraits).contains(newTraitName)) {
                break;
              }
            }
            MainActivity.dt.insertTraits(newTraitName,getItem(position).format,getItem(position).defaultValue,getItem(position).minimum,getItem(position).maximum,getItem(position).details,getItem(position).categories,"String_Node_Str",String.valueOf(pos));
            TraitEditorActivity.loadData();
            MainActivity.reloadData=true;
          }
 else           if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.delete))) {
            AlertDialog.Builder builder=new AlertDialog.Builder(context);
            builder.setTitle(context.getString(R.string.deletetrait));
            builder.setMessage(context.getString(R.string.areyousure));
            builder.setPositiveButton(context.getString(R.string.yes),new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int which){
                dialog.dismiss();
                MainActivity.dt.deleteTrait(holder.id);
                TraitEditorActivity.loadData();
                MainActivity.reloadData=true;
              }
            }
);
            builder.setNegativeButton(context.getString(R.string.no),new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int which){
                dialog.dismiss();
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
 else           if (item.getTitle().equals(TraitEditorActivity.thisActivity.getString(R.string.edit))) {
            listener.onItemClick((AdapterView)parent,v,position,v.getId());
          }
          return false;
        }
      }
);
      popup.show();
    }
  }
);
  return convertView;
}