Program: 62043
Project: 62043
Buggy source:
public static String convertShape(HashMap<Integer,CharacterTag> characters,MATRIX mat,int shapeNum,List<SHAPERECORD> shapeRecords,FILLSTYLEARRAY fillStyles,LINESTYLEARRAY lineStyles,boolean morphshape){
  String ret="String_Node_Str";
  if (mat == null) {
    mat=new MATRIX();
  }
  List<SHAPERECORD> edges=new ArrayList<>();
  int lineStyleCount=0;
  int fillStyle0=-1;
  int fillStyle1=-1;
  int strokeStyle=-1;
  String fillsStr="String_Node_Str";
  String strokesStr="String_Node_Str";
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  List<String> layers=new ArrayList<>();
  String currentLayer="String_Node_Str";
  int fillStyleCount=0;
  if (fillStyles != null) {
    for (    FILLSTYLE fs : fillStyles.fillStyles) {
      fillsStr+="String_Node_Str" + (fillStyleCount + 1) + "String_Node_Str";
      fillsStr+=convertFillStyle(mat,characters,fs,shapeNum);
      fillsStr+="String_Node_Str";
      fillStyleCount++;
    }
  }
  if (lineStyles != null) {
    if ((shapeNum == 4) && (lineStyles.lineStyles2 != null)) {
      for (int l=0; l < lineStyles.lineStyles2.length; l++) {
        strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
        strokesStr+=convertLineStyle(characters,lineStyles.lineStyles2[l],shapeNum);
        strokesStr+="String_Node_Str";
        lineStyleCount++;
      }
    }
 else     if (lineStyles.lineStyles != null) {
      for (int l=0; l < lineStyles.lineStyles.length; l++) {
        strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
        strokesStr+=convertLineStyle(lineStyles.lineStyles[l],shapeNum);
        strokesStr+="String_Node_Str";
        lineStyleCount++;
      }
    }
  }
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  int layer=1;
  if ((fillStyleCount > 0) || (lineStyleCount > 0)) {
    currentLayer+="String_Node_Str" + (layer++) + "String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str" + KEY_MODE_SHAPE_LAYERS + "String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+=fillsStr;
    currentLayer+=strokesStr;
    currentLayer+="String_Node_Str";
  }
  int x=0;
  int y=0;
  int startEdgeX=0;
  int startEdgeY=0;
  LINESTYLEARRAY actualLinestyles=lineStyles;
  int strokeStyleOrig=0;
  fillStyleCount=fillStyles.fillStyles.length;
  for (  SHAPERECORD edge : shapeRecords) {
    if (edge instanceof StyleChangeRecord) {
      StyleChangeRecord scr=(StyleChangeRecord)edge;
      boolean styleChange=false;
      int lastFillStyle1=fillStyle1;
      int lastFillStyle0=fillStyle0;
      int lastStrokeStyle=strokeStyle;
      if (scr.stateNewStyles) {
        fillsStr="String_Node_Str";
        strokesStr="String_Node_Str";
        if (fillStyleCount > 0 || lineStyleCount > 0) {
          if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
            boolean empty=false;
            if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
              if (shapeNum == 4) {
                if (strokeStyleOrig > 0) {
                  if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                      if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                        if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                          if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                            empty=true;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
            if (!empty) {
              currentLayer+="String_Node_Str";
              if (fillStyle0 > -1) {
                currentLayer+="String_Node_Str" + fillStyle0 + "String_Node_Str";
              }
              if (fillStyle1 > -1) {
                currentLayer+="String_Node_Str" + fillStyle1 + "String_Node_Str";
              }
              if (strokeStyle > -1) {
                currentLayer+="String_Node_Str" + strokeStyle + "String_Node_Str";
              }
              currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
            }
          }
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          layers.add(currentLayer);
          currentLayer="String_Node_Str";
        }
        currentLayer+="String_Node_Str" + (layer++) + "String_Node_Str";
        currentLayer+="String_Node_Str";
        currentLayer+="String_Node_Str" + KEY_MODE_SHAPE_LAYERS + "String_Node_Str";
        currentLayer+="String_Node_Str";
        currentLayer+="String_Node_Str";
        for (int f=0; f < scr.fillStyles.fillStyles.length; f++) {
          fillsStr+="String_Node_Str" + (f + 1) + "String_Node_Str";
          fillsStr+=convertFillStyle(mat,characters,scr.fillStyles.fillStyles[f],shapeNum);
          fillsStr+="String_Node_Str";
          fillStyleCount++;
        }
        if (shapeNum == 4) {
          for (int l=0; l < scr.lineStyles.lineStyles2.length; l++) {
            strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
            strokesStr+=convertLineStyle(characters,scr.lineStyles.lineStyles2[l],shapeNum);
            strokesStr+="String_Node_Str";
            lineStyleCount++;
          }
        }
 else {
          for (int l=0; l < scr.lineStyles.lineStyles.length; l++) {
            strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
            strokesStr+=convertLineStyle(scr.lineStyles.lineStyles[l],shapeNum);
            strokesStr+="String_Node_Str";
            lineStyleCount++;
          }
        }
        fillsStr+="String_Node_Str";
        strokesStr+="String_Node_Str";
        currentLayer+=fillsStr;
        currentLayer+=strokesStr;
        currentLayer+="String_Node_Str";
        actualLinestyles=scr.lineStyles;
      }
      if (scr.stateFillStyle0) {
        int fillStyle0_new=scr.fillStyle0;
        if (morphshape) {
          fillStyle1=fillStyle0_new;
        }
 else {
          fillStyle0=fillStyle0_new;
        }
        styleChange=true;
      }
      if (scr.stateFillStyle1) {
        int fillStyle1_new=scr.fillStyle1;
        if (morphshape) {
          fillStyle0=fillStyle1_new;
        }
 else {
          fillStyle1=fillStyle1_new;
        }
        styleChange=true;
      }
      if (scr.stateLineStyle) {
        strokeStyle=scr.lineStyle;
        strokeStyleOrig=scr.lineStyle - 1;
        styleChange=true;
      }
      if (!edges.isEmpty()) {
        if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
          boolean empty=false;
          if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
            if (shapeNum == 4) {
              if (strokeStyleOrig > 0) {
                if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
                  if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                      if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                        if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                          empty=true;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          if (!empty) {
            currentLayer+="String_Node_Str";
            if (fillStyle0 > -1) {
              currentLayer+="String_Node_Str" + lastFillStyle0 + "String_Node_Str";
            }
            if (fillStyle1 > -1) {
              currentLayer+="String_Node_Str" + lastFillStyle1 + "String_Node_Str";
            }
            if (strokeStyle > -1) {
              currentLayer+="String_Node_Str" + lastStrokeStyle + "String_Node_Str";
            }
            currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
          }
          startEdgeX=x;
          startEdgeY=y;
        }
        edges.clear();
      }
    }
    edges.add(edge);
    x=edge.changeX(x);
    y=edge.changeY(y);
  }
  if (!edges.isEmpty()) {
    if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
      boolean empty=false;
      if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
        if (shapeNum == 4) {
          if (strokeStyleOrig > 0) {
            if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
              if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                  if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                      empty=true;
                    }
                  }
                }
              }
            }
          }
        }
      }
      if (!empty) {
        currentLayer+="String_Node_Str";
        if (fillStyle0 > -1) {
          currentLayer+="String_Node_Str" + fillStyle0 + "String_Node_Str";
        }
        if (fillStyle1 > -1) {
          currentLayer+="String_Node_Str" + fillStyle1 + "String_Node_Str";
        }
        if (strokeStyle > -1) {
          currentLayer+="String_Node_Str" + strokeStyle + "String_Node_Str";
        }
        currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
      }
    }
  }
  edges.clear();
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  currentLayer+="String_Node_Str";
  currentLayer+="String_Node_Str";
  currentLayer+="String_Node_Str";
  currentLayer+="String_Node_Str";
  currentLayer+="String_Node_Str";
  currentLayer+="String_Node_Str";
  layers.add(currentLayer);
  for (int l=layers.size() - 1; l >= 0; l--) {
    ret+=layers.get(l);
  }
  return ret;
}

Fixed version (ground truth):
public static String convertShape(HashMap<Integer,CharacterTag> characters,MATRIX mat,int shapeNum,List<SHAPERECORD> shapeRecords,FILLSTYLEARRAY fillStyles,LINESTYLEARRAY lineStyles,boolean morphshape){
  String ret="String_Node_Str";
  if (mat == null) {
    mat=new MATRIX();
  }
  List<SHAPERECORD> edges=new ArrayList<>();
  int lineStyleCount=0;
  int fillStyle0=-1;
  int fillStyle1=-1;
  int strokeStyle=-1;
  String fillsStr="String_Node_Str";
  String strokesStr="String_Node_Str";
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  List<String> layers=new ArrayList<>();
  String currentLayer="String_Node_Str";
  int fillStyleCount=0;
  if (fillStyles != null) {
    for (    FILLSTYLE fs : fillStyles.fillStyles) {
      fillsStr+="String_Node_Str" + (fillStyleCount + 1) + "String_Node_Str";
      fillsStr+=convertFillStyle(mat,characters,fs,shapeNum);
      fillsStr+="String_Node_Str";
      fillStyleCount++;
    }
  }
  if (lineStyles != null) {
    if ((shapeNum == 4) && (lineStyles.lineStyles2 != null)) {
      for (int l=0; l < lineStyles.lineStyles2.length; l++) {
        strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
        strokesStr+=convertLineStyle(characters,lineStyles.lineStyles2[l],shapeNum);
        strokesStr+="String_Node_Str";
        lineStyleCount++;
      }
    }
 else     if (lineStyles.lineStyles != null) {
      for (int l=0; l < lineStyles.lineStyles.length; l++) {
        strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
        strokesStr+=convertLineStyle(lineStyles.lineStyles[l],shapeNum);
        strokesStr+="String_Node_Str";
        lineStyleCount++;
      }
    }
  }
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  int layer=1;
  if ((fillStyleCount > 0) || (lineStyleCount > 0)) {
    currentLayer+="String_Node_Str" + (layer++) + "String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str" + KEY_MODE_SHAPE_LAYERS + "String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+=fillsStr;
    currentLayer+=strokesStr;
    currentLayer+="String_Node_Str";
  }
  int x=0;
  int y=0;
  int startEdgeX=0;
  int startEdgeY=0;
  LINESTYLEARRAY actualLinestyles=lineStyles;
  int strokeStyleOrig=0;
  fillStyleCount=fillStyles.fillStyles.length;
  for (  SHAPERECORD edge : shapeRecords) {
    if (edge instanceof StyleChangeRecord) {
      StyleChangeRecord scr=(StyleChangeRecord)edge;
      boolean styleChange=false;
      int lastFillStyle1=fillStyle1;
      int lastFillStyle0=fillStyle0;
      int lastStrokeStyle=strokeStyle;
      if (scr.stateNewStyles) {
        fillsStr="String_Node_Str";
        strokesStr="String_Node_Str";
        if (fillStyleCount > 0 || lineStyleCount > 0) {
          if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
            boolean empty=false;
            if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
              if (shapeNum == 4) {
                if (strokeStyleOrig > 0) {
                  if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                      if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                        if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                          if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                            empty=true;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
            if (!empty) {
              currentLayer+="String_Node_Str";
              if (fillStyle0 > -1) {
                currentLayer+="String_Node_Str" + fillStyle0 + "String_Node_Str";
              }
              if (fillStyle1 > -1) {
                currentLayer+="String_Node_Str" + fillStyle1 + "String_Node_Str";
              }
              if (strokeStyle > -1) {
                currentLayer+="String_Node_Str" + strokeStyle + "String_Node_Str";
              }
              currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
            }
          }
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          currentLayer+="String_Node_Str";
          layers.add(currentLayer);
          currentLayer="String_Node_Str";
        }
        currentLayer+="String_Node_Str" + (layer++) + "String_Node_Str";
        currentLayer+="String_Node_Str";
        currentLayer+="String_Node_Str" + KEY_MODE_SHAPE_LAYERS + "String_Node_Str";
        currentLayer+="String_Node_Str";
        currentLayer+="String_Node_Str";
        for (int f=0; f < scr.fillStyles.fillStyles.length; f++) {
          fillsStr+="String_Node_Str" + (f + 1) + "String_Node_Str";
          fillsStr+=convertFillStyle(mat,characters,scr.fillStyles.fillStyles[f],shapeNum);
          fillsStr+="String_Node_Str";
          fillStyleCount++;
        }
        if (shapeNum == 4) {
          for (int l=0; l < scr.lineStyles.lineStyles2.length; l++) {
            strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
            strokesStr+=convertLineStyle(characters,scr.lineStyles.lineStyles2[l],shapeNum);
            strokesStr+="String_Node_Str";
            lineStyleCount++;
          }
        }
 else {
          for (int l=0; l < scr.lineStyles.lineStyles.length; l++) {
            strokesStr+="String_Node_Str" + (lineStyleCount + 1) + "String_Node_Str";
            strokesStr+=convertLineStyle(scr.lineStyles.lineStyles[l],shapeNum);
            strokesStr+="String_Node_Str";
            lineStyleCount++;
          }
        }
        fillsStr+="String_Node_Str";
        strokesStr+="String_Node_Str";
        currentLayer+=fillsStr;
        currentLayer+=strokesStr;
        currentLayer+="String_Node_Str";
        actualLinestyles=scr.lineStyles;
      }
      if (scr.stateFillStyle0) {
        int fillStyle0_new=scr.fillStyle0;
        if (morphshape) {
          fillStyle1=fillStyle0_new;
        }
 else {
          fillStyle0=fillStyle0_new;
        }
        styleChange=true;
      }
      if (scr.stateFillStyle1) {
        int fillStyle1_new=scr.fillStyle1;
        if (morphshape) {
          fillStyle0=fillStyle1_new;
        }
 else {
          fillStyle1=fillStyle1_new;
        }
        styleChange=true;
      }
      if (scr.stateLineStyle) {
        strokeStyle=scr.lineStyle;
        strokeStyleOrig=scr.lineStyle - 1;
        styleChange=true;
      }
      if (!edges.isEmpty()) {
        if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
          boolean empty=false;
          if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
            if (shapeNum == 4) {
              if (strokeStyleOrig > 0) {
                if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
                  if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                      if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                        if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                          empty=true;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          if (!empty) {
            currentLayer+="String_Node_Str";
            if (fillStyle0 > -1) {
              currentLayer+="String_Node_Str" + lastFillStyle0 + "String_Node_Str";
            }
            if (fillStyle1 > -1) {
              currentLayer+="String_Node_Str" + lastFillStyle1 + "String_Node_Str";
            }
            if (strokeStyle > -1) {
              currentLayer+="String_Node_Str" + lastStrokeStyle + "String_Node_Str";
            }
            currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
          }
          startEdgeX=x;
          startEdgeY=y;
        }
        edges.clear();
      }
    }
    edges.add(edge);
    x=edge.changeX(x);
    y=edge.changeY(y);
  }
  if (!edges.isEmpty()) {
    if ((fillStyle0 > 0) || (fillStyle1 > 0) || (strokeStyle > 0)) {
      boolean empty=false;
      if ((fillStyle0 <= 0) && (fillStyle1 <= 0) && (strokeStyle > 0)&& morphshape) {
        if (shapeNum == 4) {
          if (strokeStyleOrig > 0) {
            if (!actualLinestyles.lineStyles2[strokeStyleOrig].hasFillFlag) {
              if (actualLinestyles.lineStyles2[strokeStyleOrig].color.alpha == 0) {
                if (actualLinestyles.lineStyles2[strokeStyleOrig].color.red == 0) {
                  if (actualLinestyles.lineStyles2[strokeStyleOrig].color.green == 0) {
                    if (actualLinestyles.lineStyles2[strokeStyleOrig].color.blue == 0) {
                      empty=true;
                    }
                  }
                }
              }
            }
          }
        }
      }
      if (!empty) {
        currentLayer+="String_Node_Str";
        if (fillStyle0 > -1) {
          currentLayer+="String_Node_Str" + fillStyle0 + "String_Node_Str";
        }
        if (fillStyle1 > -1) {
          currentLayer+="String_Node_Str" + fillStyle1 + "String_Node_Str";
        }
        if (strokeStyle > -1) {
          currentLayer+="String_Node_Str" + strokeStyle + "String_Node_Str";
        }
        currentLayer+="String_Node_Str" + convertShapeEdges(startEdgeX,startEdgeY,mat,edges) + "String_Node_Str";
      }
    }
  }
  edges.clear();
  fillsStr+="String_Node_Str";
  strokesStr+="String_Node_Str";
  if (!currentLayer.equals("String_Node_Str")) {
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    currentLayer+="String_Node_Str";
    layers.add(currentLayer);
  }
  for (int l=layers.size() - 1; l >= 0; l--) {
    ret+=layers.get(l);
  }
  return ret;
}