Program: 70798
Project: 70798
Buggy source:
private void refreshTextures(GL gl){
  if (textureLoader != null) {
    for (int i=0; i < 3; i++) {
      if (!textureLoader.isTextureValid(textureIds[i])) {
        int nx=myImage.getNumCols();
        int ny=myImage.getNumRows();
        int nz=myImage.getNumSlices();
switch (i) {
case 0:
{
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
                byte[] image=new byte[ny * nz];
                myImage.getPixelsByte(sliceCoordIdxs[0],0,0,1,1,1,1,ny,nz,timeIdx,image,converter);
                int src=GL2.GL_RED;
                int dst=GL2.GL_LUMINANCE;
                int max=0;
                for (int j=0; j < image.length; j++) {
                  int val=0xFF & image[j];
                  if (val > max) {
                    max=val;
                  }
                }
                textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,ny,nz,src,dst);
                break;
              }
case RGB:
{
              byte[] image=new byte[3 * ny * nz];
              myImage.getPixelsRGB(sliceCoordIdxs[0],0,0,1,1,1,1,ny,nz,timeIdx,image,converter);
              int src=GL2.GL_RGB;
              int dst=GL2.GL_RGB;
              textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,ny,nz,src,dst);
              break;
            }
        }
        break;
      }
case 1:
{
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
          byte[] image=new byte[nx * nz];
          myImage.getPixelsByte(0,sliceCoordIdxs[1],0,1,1,1,nx,1,nz,timeIdx,image,converter);
          int src=GL2.GL_RED;
          int dst=GL2.GL_LUMINANCE;
          int max=0;
          for (int j=0; j < image.length; j++) {
            int val=0xFF & image[j];
            if (val > max) {
              max=val;
            }
          }
          textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,nz,src,dst);
          break;
        }
case RGB:
{
        byte[] image=new byte[3 * nx * nz];
        myImage.getPixelsRGB(0,sliceCoordIdxs[1],0,1,1,1,nx,1,nz,timeIdx,image,converter);
        int src=GL2.GL_RGB;
        int dst=GL2.GL_RGB;
        textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,nz,src,dst);
        break;
      }
  }
  break;
}
case 2:
{
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
    byte[] image=new byte[nx * ny];
    myImage.getPixelsByte(0,0,sliceCoordIdxs[2],1,1,1,nx,ny,1,timeIdx,image,converter);
    int src=GL2.GL_RED;
    int dst=GL2.GL_LUMINANCE;
    int max=0;
    for (int j=0; j < image.length; j++) {
      int val=0xFF & image[j];
      if (val > max) {
        max=val;
      }
    }
    textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,ny,src,dst);
    break;
  }
case RGB:
{
  byte[] image=new byte[3 * nx * ny];
  myImage.getPixelsRGB(0,0,sliceCoordIdxs[2],1,1,1,nx,ny,1,timeIdx,image,converter);
  int src=GL2.GL_RGB;
  int dst=GL2.GL_RGB;
  textureLoader.getTexture(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,ny,src,dst);
  break;
}
}
break;
}
}
}
}
}
}

Fixed version (ground truth):
private void refreshTextures(GL gl){
  if (textureLoader != null) {
    for (int i=0; i < 3; i++) {
      if (!textureLoader.isTextureValid(textureIds[i])) {
        int nx=myImage.getNumCols();
        int ny=myImage.getNumRows();
        int nz=myImage.getNumSlices();
switch (i) {
case 0:
{
            if (yz != null) {
              yz.releaseDispose(gl);
            }
            yz=null;
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
                byte[] image=new byte[ny * nz];
                myImage.getPixelsByte(sliceCoordIdxs[0],0,0,1,1,1,1,ny,nz,timeIdx,image,converter);
                int src=GL2.GL_RED;
                int dst=GL2.GL_LUMINANCE;
                int max=0;
                for (int j=0; j < image.length; j++) {
                  int val=0xFF & image[j];
                  if (val > max) {
                    max=val;
                  }
                }
                yz=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,ny,nz,src,dst);
                break;
              }
case RGB:
{
              byte[] image=new byte[3 * ny * nz];
              myImage.getPixelsRGB(sliceCoordIdxs[0],0,0,1,1,1,1,ny,nz,timeIdx,image,converter);
              int src=GL2.GL_RGB;
              int dst=GL2.GL_RGB;
              yz=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,ny,nz,src,dst);
              break;
            }
        }
        break;
      }
case 1:
{
      if (xz != null) {
        xz.releaseDispose(gl);
      }
      xz=null;
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
          byte[] image=new byte[nx * nz];
          myImage.getPixelsByte(0,sliceCoordIdxs[1],0,1,1,1,nx,1,nz,timeIdx,image,converter);
          int src=GL2.GL_RED;
          int dst=GL2.GL_LUMINANCE;
          int max=0;
          for (int j=0; j < image.length; j++) {
            int val=0xFF & image[j];
            if (val > max) {
              max=val;
            }
          }
          xz=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,nz,src,dst);
          break;
        }
case RGB:
{
        byte[] image=new byte[3 * nx * nz];
        myImage.getPixelsRGB(0,sliceCoordIdxs[1],0,1,1,1,nx,1,nz,timeIdx,image,converter);
        int src=GL2.GL_RGB;
        int dst=GL2.GL_RGB;
        xz=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,nz,src,dst);
        break;
      }
  }
  break;
}
case 2:
{
if (xy != null) {
  xy.releaseDispose(gl);
}
xy=null;
switch (myImage.getPixelType()) {
case BYTE:
case SHORT:
{
    byte[] image=new byte[nx * ny];
    myImage.getPixelsByte(0,0,sliceCoordIdxs[2],1,1,1,nx,ny,1,timeIdx,image,converter);
    int src=GL2.GL_RED;
    int dst=GL2.GL_LUMINANCE;
    int max=0;
    for (int j=0; j < image.length; j++) {
      int val=0xFF & image[j];
      if (val > max) {
        max=val;
      }
    }
    xy=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,ny,src,dst);
    break;
  }
case RGB:
{
  byte[] image=new byte[3 * nx * ny];
  myImage.getPixelsRGB(0,0,sliceCoordIdxs[2],1,1,1,nx,ny,1,timeIdx,image,converter);
  int src=GL2.GL_RGB;
  int dst=GL2.GL_RGB;
  xy=textureLoader.getTextureAcquired(gl,textureIds[i],GL.GL_TEXTURE_2D,image,nx,ny,src,dst);
  break;
}
}
break;
}
}
}
}
}
}