Program: 70796
Project: 70796
Buggy source:
private void maybeCommitViewerState(GL2 gl,ViewerState state){
  if (isSelecting()) {
    if (myCommittedViewerState.lightingEnabled == true) {
      gl.glDisable(GL2.GL_LIGHTING);
      myCommittedViewerState.lightingEnabled=false;
    }
    if (myCommittedViewerState.colorEnabled == false) {
      gl.glColorMask(true,true,true,true);
      myCommittedViewerState.colorEnabled=true;
    }
    if (myCommittedViewerState.transparencyEnabled == true) {
      gl.glDisable(GL.GL_BLEND);
      myCommittedViewerState.transparencyEnabled=false;
    }
  }
 else {
    if (myCommittedViewerState.lightingEnabled != state.lightingEnabled) {
      if (state.lightingEnabled) {
        gl.glEnable(GL2.GL_LIGHTING);
      }
 else {
        gl.glDisable(GL2.GL_LIGHTING);
      }
      myCommittedViewerState.lightingEnabled=state.lightingEnabled;
    }
    if (myCommittedViewerState.colorEnabled != state.colorEnabled) {
      if (state.colorEnabled) {
        gl.glColorMask(true,true,true,true);
      }
 else {
        gl.glColorMask(false,false,false,false);
      }
      myCommittedViewerState.colorEnabled=state.colorEnabled;
    }
    if (myCommittedViewerState.transparencyEnabled != state.transparencyEnabled) {
      if (state.transparencyEnabled) {
        gl.glEnable(GL.GL_BLEND);
      }
 else {
        gl.glDisable(GL.GL_BLEND);
      }
      myCommittedViewerState.transparencyEnabled=state.transparencyEnabled;
    }
  }
  if (myCommittedViewerState.depthEnabled != state.depthEnabled) {
    if (state.depthEnabled) {
      gl.glEnable(GL.GL_DEPTH_TEST);
    }
 else {
      gl.glDisable(GL.GL_DEPTH_TEST);
    }
    myCommittedViewerState.depthEnabled=state.depthEnabled;
  }
  if (myCommittedViewerState.faceMode != state.faceMode) {
switch (state.faceMode) {
case BACK:
      gl.glEnable(GL.GL_CULL_FACE);
    gl.glCullFace(GL.GL_FRONT);
  break;
case FRONT:
gl.glEnable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_BACK);
break;
case FRONT_AND_BACK:
gl.glDisable(GL.GL_CULL_FACE);
break;
case NONE:
gl.glEnable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_FRONT_AND_BACK);
break;
default :
break;
}
myCommittedViewerState.faceMode=state.faceMode;
}
if (myCommittedViewerState.shading != state.shading) {
switch (state.shading) {
case FLAT:
gl.glShadeModel(GL2.GL_FLAT);
break;
case GOURAUD:
case PHONG:
gl.glShadeModel(GL2.GL_SMOOTH);
break;
case NONE:
gl.glDisable(GL2.GL_LIGHTING);
myCommittedViewerState.lightingEnabled=false;
break;
default :
break;
}
myCommittedViewerState.shading=state.shading;
}
if (myCommittedViewerState.roundedPoints != state.roundedPoints) {
if (state.roundedPoints) {
gl.glEnable(GL2.GL_POINT_SMOOTH);
gl.glHint(GL2.GL_POINT_SMOOTH_HINT,GL2.GL_NICEST);
}
 else {
gl.glDisable(GL2.GL_POINT_SMOOTH);
gl.glHint(GL2.GL_POINT_SMOOTH_HINT,GL2.GL_FASTEST);
}
myCommittedViewerState.roundedPoints=state.roundedPoints;
}
}

Fixed version (ground truth):
private void maybeCommitViewerState(GL2 gl,ViewerState state){
  if (isSelecting()) {
    if (myCommittedViewerState.lightingEnabled == true) {
      gl.glDisable(GL2.GL_LIGHTING);
      myCommittedViewerState.lightingEnabled=false;
      myCommittedViewerState.shading=Shading.NONE;
    }
    if (myCommittedViewerState.colorEnabled == false) {
      gl.glColorMask(true,true,true,true);
      myCommittedViewerState.colorEnabled=true;
    }
    if (myCommittedViewerState.transparencyEnabled == true) {
      gl.glDisable(GL.GL_BLEND);
      myCommittedViewerState.transparencyEnabled=false;
    }
  }
 else {
    if (myCommittedViewerState.lightingEnabled != state.lightingEnabled) {
      if (state.lightingEnabled && state.shading != Shading.NONE) {
        gl.glEnable(GL2.GL_LIGHTING);
        myCommittedViewerState.lightingEnabled=true;
      }
 else {
        gl.glDisable(GL2.GL_LIGHTING);
        myCommittedViewerState.shading=Shading.NONE;
        myCommittedViewerState.lightingEnabled=false;
      }
    }
    if (myCommittedViewerState.colorEnabled != state.colorEnabled) {
      if (state.colorEnabled) {
        gl.glColorMask(true,true,true,true);
      }
 else {
        gl.glColorMask(false,false,false,false);
      }
      myCommittedViewerState.colorEnabled=state.colorEnabled;
    }
    if (myCommittedViewerState.transparencyEnabled != state.transparencyEnabled) {
      if (state.transparencyEnabled) {
        gl.glEnable(GL.GL_BLEND);
      }
 else {
        gl.glDisable(GL.GL_BLEND);
      }
      myCommittedViewerState.transparencyEnabled=state.transparencyEnabled;
    }
  }
  if (myCommittedViewerState.depthEnabled != state.depthEnabled) {
    if (state.depthEnabled) {
      gl.glEnable(GL.GL_DEPTH_TEST);
    }
 else {
      gl.glDisable(GL.GL_DEPTH_TEST);
    }
    myCommittedViewerState.depthEnabled=state.depthEnabled;
  }
  if (myCommittedViewerState.faceMode != state.faceMode) {
switch (state.faceMode) {
case BACK:
      gl.glEnable(GL.GL_CULL_FACE);
    gl.glCullFace(GL.GL_FRONT);
  break;
case FRONT:
gl.glEnable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_BACK);
break;
case FRONT_AND_BACK:
gl.glDisable(GL.GL_CULL_FACE);
break;
case NONE:
gl.glEnable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_FRONT_AND_BACK);
break;
default :
break;
}
myCommittedViewerState.faceMode=state.faceMode;
}
if (myCommittedViewerState.lightingEnabled && myCommittedViewerState.shading != state.shading) {
switch (state.shading) {
case FLAT:
gl.glShadeModel(GL2.GL_FLAT);
break;
case GOURAUD:
case PHONG:
gl.glShadeModel(GL2.GL_SMOOTH);
break;
case NONE:
gl.glDisable(GL2.GL_LIGHTING);
gl.glShadeModel(GL2.GL_SMOOTH);
myCommittedViewerState.lightingEnabled=false;
break;
default :
break;
}
myCommittedViewerState.shading=state.shading;
}
if (myCommittedViewerState.roundedPoints != state.roundedPoints) {
if (state.roundedPoints) {
gl.glEnable(GL2.GL_POINT_SMOOTH);
gl.glHint(GL2.GL_POINT_SMOOTH_HINT,GL2.GL_NICEST);
}
 else {
gl.glDisable(GL2.GL_POINT_SMOOTH);
gl.glHint(GL2.GL_POINT_SMOOTH_HINT,GL2.GL_FASTEST);
}
myCommittedViewerState.roundedPoints=state.roundedPoints;
}
}