Program: 10593
Project: 10593
Buggy source:
@Override public NBTTagCompound writeToPortableNBT(NBTTagCompound tag){
  tag=super.writeToPortableNBT(tag);
  tag.setInteger("String_Node_Str",drawerCapacity);
  if (material != null)   tag.setString("String_Node_Str",material);
  NBTTagList upgradeList=new NBTTagList();
  for (int i=0; i < upgrades.length; i++) {
    if (upgrades[i] != null) {
      NBTTagCompound upgradeTag=upgrades[i].writeToNBT(new NBTTagCompound());
      upgradeTag.setByte("String_Node_Str",(byte)i);
      upgradeList.appendTag(upgradeTag);
    }
  }
  if (upgradeList.tagCount() > 0)   tag.setTag("String_Node_Str",upgradeList);
  if (lockAttributes != null)   tag.setByte("String_Node_Str",(byte)LockAttribute.getBitfield(lockAttributes));
  if (shrouded)   tag.setBoolean("String_Node_Str",shrouded);
  if (quantified)   tag.setBoolean("String_Node_Str",true);
  if (owner != null)   tag.setString("String_Node_Str",owner.toString());
  if (securityKey != null)   tag.setString("String_Node_Str",securityKey);
  if (hideUpgrade)   tag.setBoolean("String_Node_Str",hideUpgrade);
  NBTTagList slots=new NBTTagList();
  for (  IDrawer drawer : drawers) {
    NBTTagCompound slot=new NBTTagCompound();
    drawer.writeToNBT(slot);
    slots.appendTag(slot);
  }
  tag.setTag("String_Node_Str",slots);
  if (materialSide != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialSide.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  if (materialFront != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialFront.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  if (materialTrim != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialTrim.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  return tag;
}

Fixed version (ground truth):
@Override public NBTTagCompound writeToPortableNBT(NBTTagCompound tag){
  tag=super.writeToPortableNBT(tag);
  tag.setInteger("String_Node_Str",getDrawerCapacity());
  if (material != null)   tag.setString("String_Node_Str",material);
  NBTTagList upgradeList=new NBTTagList();
  for (int i=0; i < upgrades.length; i++) {
    if (upgrades[i] != null) {
      NBTTagCompound upgradeTag=upgrades[i].writeToNBT(new NBTTagCompound());
      upgradeTag.setByte("String_Node_Str",(byte)i);
      upgradeList.appendTag(upgradeTag);
    }
  }
  if (upgradeList.tagCount() > 0)   tag.setTag("String_Node_Str",upgradeList);
  if (lockAttributes != null)   tag.setByte("String_Node_Str",(byte)LockAttribute.getBitfield(lockAttributes));
  if (shrouded)   tag.setBoolean("String_Node_Str",shrouded);
  if (quantified)   tag.setBoolean("String_Node_Str",true);
  if (owner != null)   tag.setString("String_Node_Str",owner.toString());
  if (securityKey != null)   tag.setString("String_Node_Str",securityKey);
  if (hideUpgrade)   tag.setBoolean("String_Node_Str",hideUpgrade);
  NBTTagList slots=new NBTTagList();
  for (  IDrawer drawer : drawers) {
    NBTTagCompound slot=new NBTTagCompound();
    drawer.writeToNBT(slot);
    slots.appendTag(slot);
  }
  tag.setTag("String_Node_Str",slots);
  if (materialSide != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialSide.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  if (materialFront != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialFront.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  if (materialTrim != null) {
    NBTTagCompound itag=new NBTTagCompound();
    materialTrim.writeToNBT(itag);
    tag.setTag("String_Node_Str",itag);
  }
  return tag;
}