Program: 163807
Project: 163807
Buggy source:
public void spotLight(float r,float g,float b,float x,float y,float z,float nx,float ny,float nz,float angle,float concentration){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=SPOT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=0.0f;
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  lightSpotAngle[lightCount]=angle;
  lightSpotAngleCos[lightCount]=Math.max(0,(float)Math.cos(angle));
  lightSpotConcentration[lightCount]=concentration;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightSpotAngle(lightCount);
  glLightSpotConcentration(lightCount);
  lightCount++;
}

Fixed version (ground truth):
public void spotLight(float r,float g,float b,float x,float y,float z,float nx,float ny,float nz,float angle,float concentration){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=SPOT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  lightSpotAngle[lightCount]=PApplet.degrees(angle);
  lightSpotAngleCos[lightCount]=Math.max(0,(float)Math.cos(angle));
  lightSpotConcentration[lightCount]=concentration;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightSpotAngle(lightCount);
  glLightSpotConcentration(lightCount);
  lightCount++;
}