Program: 178040
Project: 178040
Buggy source:
/** 
 * Gets the dat from a string
 * @param type     Data Value string
 * @param material Material
 * @return data
 */
public static MaterialData getData(String type,Material material){
  type=type.toUpperCase().replace("String_Node_Str","String_Node_Str");
  MaterialData materialData=new ItemStack(material).getData();
  if (materialData instanceof TexturedMaterial) {
    TexturedMaterial texturedMaterial=(TexturedMaterial)materialData;
    Material texture=new EnumParser<Material>().parse(type,texturedMaterial.getTextures().toArray(new Material[0]));
    if (texture != null) {
      ((TexturedMaterial)materialData).setMaterial(texture);
    }
  }
 else   if (materialData instanceof Colorable) {
    DyeColor color=new EnumParser<DyeColor>().parse(type,DyeColor.values());
    if (color != null) {
      ((Colorable)materialData).setColor(color);
    }
  }
 else   if (materialData instanceof Wood) {
    TreeSpecies species=new EnumParser<TreeSpecies>().parse(type,TreeSpecies.values());
    if (species != null) {
      ((Wood)materialData).setSpecies(species);
    }
  }
 else   if (materialData instanceof SpawnEgg) {
    EntityType entityType=new EnumParser<EntityType>().parse(type,EntityType.values());
    if (entityType != null) {
      ((SpawnEgg)materialData).setSpawnedType(entityType);
    }
  }
 else   if (materialData instanceof Coal) {
    CoalType coalType=new EnumParser<CoalType>().parse(type,CoalType.values());
    if (coalType != null) {
      ((Coal)materialData).setType(coalType);
    }
  }
 else   if (materialData instanceof Sandstone) {
    SandstoneType sandstoneType=new EnumParser<SandstoneType>().parse(type,SandstoneType.values());
    if (sandstoneType != null) {
      ((Sandstone)materialData).setType(sandstoneType);
    }
  }
  return materialData;
}

Fixed version (ground truth):
/** 
 * Gets the dat from a string
 * @param type     Data Value string
 * @param material Material
 * @return data    The Material data with that name, under some circumstances the type of the data might bedifferent from the inputted Material. (e.g. with LOG_2 or similar alternatives) It's advised to use the type of the MaterialData going forward when using the data
 */
public static MaterialData getData(String type,Material material){
  type=type.toUpperCase().replace("String_Node_Str","String_Node_Str");
  MaterialData materialData=new ItemStack(material).getData();
  if (materialData instanceof TexturedMaterial) {
    TexturedMaterial texturedMaterial=(TexturedMaterial)materialData;
    Material texture=new EnumParser<Material>().parse(type,texturedMaterial.getTextures().toArray(new Material[0]));
    if (texture != null) {
      ((TexturedMaterial)materialData).setMaterial(texture);
    }
  }
 else   if (materialData instanceof Colorable) {
    DyeColor color=new EnumParser<DyeColor>().parse(type,DyeColor.values());
    if (color != null) {
      ((Colorable)materialData).setColor(color);
    }
  }
 else   if (materialData instanceof Wood) {
    TreeSpecies species=new EnumParser<TreeSpecies>().parse(type,TreeSpecies.values());
    if (species != null) {
      try {
        ((Wood)materialData).setSpecies(species);
      }
 catch (      IllegalArgumentException e) {
        String materialName=material.toString();
        if (materialName.endsWith("String_Node_Str")) {
          Material mat=Material.getMaterial(materialName.substring(0,materialName.length() - 2));
          if (mat != null) {
            materialData=new ItemStack(mat).getData();
          }
        }
 else {
          Material mat=Material.getMaterial(materialName + "String_Node_Str");
          if (mat != null) {
            materialData=new ItemStack(mat).getData();
          }
        }
        ((Wood)materialData).setSpecies(species);
      }
    }
  }
 else   if (materialData instanceof SpawnEgg) {
    EntityType entityType=new EnumParser<EntityType>().parse(type,EntityType.values());
    if (entityType != null) {
      ((SpawnEgg)materialData).setSpawnedType(entityType);
    }
  }
 else   if (materialData instanceof Coal) {
    CoalType coalType=new EnumParser<CoalType>().parse(type,CoalType.values());
    if (coalType != null) {
      ((Coal)materialData).setType(coalType);
    }
  }
 else   if (materialData instanceof Sandstone) {
    SandstoneType sandstoneType=new EnumParser<SandstoneType>().parse(type,SandstoneType.values());
    if (sandstoneType != null) {
      ((Sandstone)materialData).setType(sandstoneType);
    }
  }
  return materialData;
}