Program: 1051
Project: 1051
Buggy source:
@Override public void reload(TextureData data){
  dispose();
  this.width=data.getWidth();
  this.height=data.getHeight();
  this.depth=data.getDepth();
  this.wrapMode=data.getWrapMode();
  this.filterMode=data.getFilterMode();
  this.textureType=data.getType();
  this.textureData=data;
switch (textureType) {
case TEXTURE2D:
    id=glGenTextures();
  logger.debug("String_Node_Str",getURI(),id);
glBindTexture(GL11.GL_TEXTURE_2D,id);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,wrapMode.getGLMode());
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,wrapMode.getGLMode());
GL11.glTexParameteri(GL_TEXTURE_2D,GL11.GL_TEXTURE_MIN_FILTER,filterMode.getGlMinFilter());
GL11.glTexParameteri(GL_TEXTURE_2D,GL11.GL_TEXTURE_MAG_FILTER,filterMode.getGlMagFilter());
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT,4);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL12.GL_TEXTURE_MAX_LEVEL,data.getBuffers().length - 1);
for (int i=0; i < data.getBuffers().length; i++) {
GL11.glTexImage2D(GL11.GL_TEXTURE_2D,i,GL11.GL_RGBA,width >> i,height >> i,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,data.getBuffers()[i]);
}
break;
case TEXTURE3D:
Util.checkGLError();
id=glGenTextures();
logger.debug("String_Node_Str",getURI(),id);
glBindTexture(GL12.GL_TEXTURE_3D,id);
glTexParameterf(GL12.GL_TEXTURE_3D,GL_TEXTURE_WRAP_S,wrapMode.getGLMode());
glTexParameterf(GL12.GL_TEXTURE_3D,GL_TEXTURE_WRAP_T,wrapMode.getGLMode());
glTexParameterf(GL12.GL_TEXTURE_3D,GL12.GL_TEXTURE_WRAP_R,wrapMode.getGLMode());
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL11.GL_TEXTURE_MIN_FILTER,filterMode.getGlMinFilter());
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL11.GL_TEXTURE_MAG_FILTER,filterMode.getGlMagFilter());
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT,4);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL12.GL_TEXTURE_MAX_LEVEL,data.getBuffers().length - 1);
for (int i=0; i < data.getBuffers().length; i++) {
GL12.glTexImage3D(GL12.GL_TEXTURE_3D,i,GL11.GL_RGBA,width,height,depth,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,data.getBuffers()[i]);
}
Util.checkGLError();
break;
}
}

Fixed version (ground truth):
@Override public void reload(TextureData data){
  Util.checkGLError();
  dispose();
  this.width=data.getWidth();
  this.height=data.getHeight();
  this.depth=data.getDepth();
  this.wrapMode=data.getWrapMode();
  this.filterMode=data.getFilterMode();
  this.textureType=data.getType();
  this.textureData=data;
switch (textureType) {
case TEXTURE2D:
    id=glGenTextures();
  logger.debug("String_Node_Str",getURI(),id);
glBindTexture(GL11.GL_TEXTURE_2D,id);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,wrapMode.getGLMode());
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,wrapMode.getGLMode());
GL11.glTexParameteri(GL_TEXTURE_2D,GL11.GL_TEXTURE_MIN_FILTER,filterMode.getGlMinFilter());
GL11.glTexParameteri(GL_TEXTURE_2D,GL11.GL_TEXTURE_MAG_FILTER,filterMode.getGlMagFilter());
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT,4);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL12.GL_TEXTURE_MAX_LEVEL,data.getBuffers().length - 1);
for (int i=0; i < data.getBuffers().length; i++) {
GL11.glTexImage2D(GL11.GL_TEXTURE_2D,i,GL11.GL_RGBA,width >> i,height >> i,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,data.getBuffers()[i]);
}
break;
case TEXTURE3D:
id=glGenTextures();
logger.debug("String_Node_Str",getURI(),id);
glBindTexture(GL12.GL_TEXTURE_3D,id);
glTexParameterf(GL12.GL_TEXTURE_3D,GL_TEXTURE_WRAP_S,wrapMode.getGLMode());
glTexParameterf(GL12.GL_TEXTURE_3D,GL_TEXTURE_WRAP_T,wrapMode.getGLMode());
glTexParameterf(GL12.GL_TEXTURE_3D,GL12.GL_TEXTURE_WRAP_R,wrapMode.getGLMode());
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL11.GL_TEXTURE_MIN_FILTER,filterMode.getGlMinFilter());
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL11.GL_TEXTURE_MAG_FILTER,filterMode.getGlMagFilter());
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT,4);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D,GL12.GL_TEXTURE_MAX_LEVEL,data.getBuffers().length - 1);
for (int i=0; i < data.getBuffers().length; i++) {
GL12.glTexImage3D(GL12.GL_TEXTURE_3D,i,GL11.GL_RGBA,width,height,depth,0,GL11.GL_RGBA,GL11.GL_UNSIGNED_BYTE,data.getBuffers()[i]);
}
break;
}
Util.checkGLError();
}