Program: 163665
Project: 163665
Buggy source:
protected PShapeOBJ(OBJFace face,OBJMaterial mtl,ArrayList<PVector> coords,ArrayList<PVector> normals,ArrayList<PVector> texcoords){
  family=GEOMETRY;
  if (face.vertIdx.size() == 3) {
    kind=TRIANGLES;
  }
 else   if (face.vertIdx.size() == 4) {
    kind=QUADS;
  }
 else {
    kind=POLYGON;
  }
  fillColor=rgbaValue(mtl.kd);
  ambientColor=rgbaValue(mtl.ka);
  specularColor=rgbaValue(mtl.ks);
  shininess=mtl.ns;
  if (mtl.kdMap != null) {
    tintColor=rgbaValue(mtl.kd,mtl.d);
  }
  vertexCount=face.vertIdx.size();
  vertices=new float[vertexCount][12];
  for (int j=0; j < face.vertIdx.size(); j++) {
    int vertIdx, normIdx;
    PVector vert, norms;
    vert=norms=null;
    vertIdx=face.vertIdx.get(j).intValue() - 1;
    vert=coords.get(vertIdx);
    if (j < face.normIdx.size()) {
      normIdx=face.normIdx.get(j).intValue() - 1;
      if (-1 < normIdx) {
        norms=normals.get(normIdx);
      }
    }
    vertices[j][X]=vert.x;
    vertices[j][Y]=vert.y;
    vertices[j][Z]=vert.z;
    vertices[j][PGraphics.R]=mtl.kd.x;
    vertices[j][PGraphics.B]=mtl.kd.y;
    vertices[j][PGraphics.G]=mtl.kd.z;
    vertices[j][PGraphics.A]=1;
    if (norms != null) {
      vertices[j][PGraphics.NX]=norms.x;
      vertices[j][PGraphics.NY]=norms.y;
      vertices[j][PGraphics.NZ]=norms.z;
    }
    if (mtl != null && mtl.kdMap != null) {
      int texIdx;
      PVector tex=null;
      if (j < face.texIdx.size()) {
        texIdx=face.texIdx.get(j).intValue() - 1;
        if (-1 < texIdx) {
          tex=texcoords.get(texIdx);
        }
      }
      image=mtl.kdMap;
      if (tex != null) {
        vertices[j][PGraphics.U]=tex.x;
        vertices[j][PGraphics.V]=tex.y;
      }
    }
  }
}

Fixed version (ground truth):
protected PShapeOBJ(OBJFace face,OBJMaterial mtl,ArrayList<PVector> coords,ArrayList<PVector> normals,ArrayList<PVector> texcoords){
  family=GEOMETRY;
  if (face.vertIdx.size() == 3) {
    kind=TRIANGLES;
  }
 else   if (face.vertIdx.size() == 4) {
    kind=QUADS;
  }
 else {
    kind=POLYGON;
  }
  stroke=false;
  fill=true;
  fillColor=rgbaValue(mtl.kd);
  ambientColor=rgbaValue(mtl.ka);
  specularColor=rgbaValue(mtl.ks);
  shininess=mtl.ns;
  if (mtl.kdMap != null) {
    tintColor=rgbaValue(mtl.kd,mtl.d);
  }
  vertexCount=face.vertIdx.size();
  vertices=new float[vertexCount][12];
  for (int j=0; j < face.vertIdx.size(); j++) {
    int vertIdx, normIdx;
    PVector vert, norms;
    vert=norms=null;
    vertIdx=face.vertIdx.get(j).intValue() - 1;
    vert=coords.get(vertIdx);
    if (j < face.normIdx.size()) {
      normIdx=face.normIdx.get(j).intValue() - 1;
      if (-1 < normIdx) {
        norms=normals.get(normIdx);
      }
    }
    vertices[j][X]=vert.x;
    vertices[j][Y]=vert.y;
    vertices[j][Z]=vert.z;
    vertices[j][PGraphics.R]=mtl.kd.x;
    vertices[j][PGraphics.G]=mtl.kd.y;
    vertices[j][PGraphics.B]=mtl.kd.z;
    vertices[j][PGraphics.A]=1;
    if (norms != null) {
      vertices[j][PGraphics.NX]=norms.x;
      vertices[j][PGraphics.NY]=norms.y;
      vertices[j][PGraphics.NZ]=norms.z;
    }
    if (mtl != null && mtl.kdMap != null) {
      int texIdx;
      PVector tex=null;
      if (j < face.texIdx.size()) {
        texIdx=face.texIdx.get(j).intValue() - 1;
        if (-1 < texIdx) {
          tex=texcoords.get(texIdx);
        }
      }
      image=mtl.kdMap;
      if (tex != null) {
        vertices[j][PGraphics.U]=tex.x;
        vertices[j][PGraphics.V]=tex.y;
      }
    }
  }
}