Program: 175087
Project: 175087
Buggy source:
@Override public void render(Object glContext){
  OpenGLContext context=(OpenGLContext)glContext;
  if (activeGir != null) {
    if (torescale) {
      torescale=false;
      tcm.clear();
    }
    GL gl=context.getGL();
    updateFutures(gl);
    float zoom=context.getZoom();
    int width=context.getWidth();
    int height=context.getHeight();
    int x=context.getX();
    int y=context.getY();
    int xx=(int)(x + xpadding);
    int yy=(int)(y + ypadding);
    int max=maxnumberoftiles;
    Cache c=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
    gl.getGL2().glTexEnvi(GL2.GL_TEXTURE_ENV,GL2.GL_TEXTURE_ENV_MODE,GL2.GL_REPLACE);
    if (zoom >= 1) {
      curlevel=(int)Math.sqrt(zoom + 1);
      for (int lll=maxlevels; (lll > curlevel - 1); lll--) {
        if (lll > maxlevels) {
          break;
        }
        lll+=increaseLevel;
        if (lll < 0) {
          continue;
        }
        if (this.mylevel != curlevel) {
          this.mylevel=curlevel;
          poolExcutorService.shutdown();
          poolExcutorService=new ThreadPoolExecutor(1,poolSize,100,TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>());
        }
        int w0=xx / ((1 << lll) << 8);
        int h0=yy / ((1 << lll) << 8);
        final String initfile=new StringBuffer("String_Node_Str").append((int)lll).append("String_Node_Str").append((activeGir instanceof TiledBufferedImage ? ((TiledBufferedImage)activeGir).getDescription() + "String_Node_Str" : "String_Node_Str")).toString();
        for (int k=0; k < max; k++) {
          for (int j=0; j < max; j++) {
            if (j + h0 < 0) {
              continue;
            }
            for (int i=0; i < max; i++) {
              if (i + w0 < 0) {
                continue;
              }
              if (arrayReadTilesOrder[i][j] == k) {
                float ymin=(float)(((j + h0) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - yy) / (height * zoom));
                float ymax=(float)(((j + h0 + 1) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - yy) / (height * zoom));
                float xmin=(float)(((i + w0) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - xx) / (1d * width * zoom));
                float xmax=(float)(((i + w0 + 1) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - xx) / (1d * width * zoom));
                if (ymin > 1 || ymax < 0) {
                  continue;
                }
                if (xmin > 1 || xmax < 0) {
                  continue;
                }
                String file=new StringBuffer(initfile).append(getBandFolder(activeBand)).append("String_Node_Str").append((i + w0)).append("String_Node_Str").append((j + h0)).append("String_Node_Str").toString();
                if (!tryMemoryCache(gl,file,xmin,xmax,ymin,ymax)) {
                  if (!tryFileCache(gl,file,lll,(i + w0),(j + h0),xmin,xmax,ymin,ymax)) {
                    if (curlevel == 0 && lll == 0) {
                      addTileToQueue(initfile,lll,(i + w0),(j + h0));
                    }
 else                     if (curlevel == lll) {
                      addTileToQueue(initfile,lll,(i + w0),(j + h0));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
 else     if (zoom > 0) {
      curlevel=0;
      int w0=xx / Constant.TILE_SIZE_IMG_LAYER;
      int h0=yy / Constant.TILE_SIZE_IMG_LAYER;
      final String initfile=new StringBuilder(c.getPath().toString()).append("String_Node_Str").append((activeGir instanceof TiledBufferedImage ? ((TiledBufferedImage)activeGir).getDescription() + "String_Node_Str" : "String_Node_Str")).toString();
      for (int j=0; j < max; j++) {
        if (j + h0 < 0) {
          continue;
        }
        for (int i=0; i < max; i++) {
          if (i + w0 < 0) {
            continue;
          }
          float ymin=(float)(((j + h0) * Constant.OVERVIEW_SIZE_DOUBLE - yy) / (height * zoom));
          float ymax=(float)(((j + h0 + 1) * Constant.OVERVIEW_SIZE_DOUBLE - yy) / (height * zoom));
          float xmin=(float)(((i + w0) * Constant.OVERVIEW_SIZE_DOUBLE - xx) / (1d * width * zoom));
          float xmax=(float)(((i + w0 + 1) * Constant.OVERVIEW_SIZE_DOUBLE - xx) / (1d * width * zoom));
          if (ymin > 1 || ymax < 0) {
            continue;
          }
          if (xmin > 1 || xmax < 0) {
            continue;
          }
          String file=new StringBuilder(initfile).append(getBandFolder(activeBand)).append("String_Node_Str").append((i + w0)).append("String_Node_Str").append((j + h0)).append("String_Node_Str").toString();
          if (!tryMemoryCache(gl,file,xmin,xmax,ymin,ymax)) {
            if (!tryFileCache(gl,file,0,(i + w0),(j + h0),xmin,xmax,ymin,ymax)) {
              addTileToQueue(initfile,0,(i + w0),(j + h0));
            }
          }
        }
      }
    }
    displayDownloading(futures.size());
    SumoPlatform.getApplication().refresh();
    if (this.disposed) {
      disposeSync();
    }
  }
}

Fixed version (ground truth):
@Override public void render(Object glContext){
  OpenGLContext context=(OpenGLContext)glContext;
  if (activeGir != null) {
    if (torescale) {
      torescale=false;
      tcm.clear();
    }
    GL gl=context.getGL();
    updateFutures(gl);
    float zoom=context.getZoom();
    int width=context.getWidth();
    int height=context.getHeight();
    int x=context.getX();
    int y=context.getY();
    int xx=(int)(x + xpadding);
    int yy=(int)(y + ypadding);
    int max=maxnumberoftiles;
    Cache c=CacheManager.getCacheInstance(activeGir.getDisplayName(activeBand));
    gl.getGL2().glTexEnvi(GL2.GL_TEXTURE_ENV,GL2.GL_TEXTURE_ENV_MODE,GL2.GL_REPLACE);
    if (zoom >= 1) {
      curlevel=(int)Math.sqrt(zoom + 1);
      for (int lll=maxlevels; (lll > curlevel - 1); lll--) {
        if (lll > maxlevels) {
          break;
        }
        lll+=increaseLevel;
        if (lll < 0) {
          continue;
        }
        if (this.mylevel != curlevel) {
          this.mylevel=curlevel;
          poolExcutorService.shutdown();
          poolExcutorService=new ThreadPoolExecutor(1,poolSize,1000,TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>());
        }
        int w0=xx / ((1 << lll) << 8);
        int h0=yy / ((1 << lll) << 8);
        final String initfile=new StringBuffer(File.separator).append((int)lll).append(File.separator).append((activeGir instanceof TiledBufferedImage ? ((TiledBufferedImage)activeGir).getDescription() + File.separator : "String_Node_Str")).toString();
        for (int k=0; k < max; k++) {
          for (int j=0; j < max; j++) {
            if (j + h0 < 0) {
              continue;
            }
            for (int i=0; i < max; i++) {
              if (i + w0 < 0) {
                continue;
              }
              if (arrayReadTilesOrder[i][j] == k) {
                float ymin=(float)(((j + h0) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - yy) / (height * zoom));
                float ymax=(float)(((j + h0 + 1) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - yy) / (height * zoom));
                float xmin=(float)(((i + w0) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - xx) / (1d * width * zoom));
                float xmax=(float)(((i + w0 + 1) * Constant.TILE_SIZE_DOUBLE * (1 << lll) - xx) / (1d * width * zoom));
                if (ymin > 1 || ymax < 0) {
                  continue;
                }
                if (xmin > 1 || xmax < 0) {
                  continue;
                }
                String file=new StringBuffer(initfile).append(getBandFolder(activeBand)).append(File.separator).append((i + w0)).append("String_Node_Str").append((j + h0)).append("String_Node_Str").toString();
                Texture t=tryMemoryCache(gl,file,xmin,xmax,ymin,ymax);
                if (t == null) {
                  BufferedImage tile=tryFileCache(gl,file,lll,(i + w0),(j + h0),xmin,xmax,ymin,ymax);
                  if (tile != null) {
                    t=AWTTextureIO.newTexture(gl.getGLProfile(),tile,false);
                    tcm.add(file,t);
                  }
                }
                if (t != null) {
                  bindTexture(gl,t,xmin,xmax,ymin,ymax);
                }
 else                 if ((curlevel == 0 && lll == 0) || (curlevel == lll)) {
                  addTileToQueue(initfile,lll,(i + w0),(j + h0));
                }
              }
            }
          }
        }
      }
    }
 else     if (zoom > 0) {
      curlevel=0;
      int w0=xx / Constant.TILE_SIZE_IMG_LAYER;
      int h0=yy / Constant.TILE_SIZE_IMG_LAYER;
      final String initfile=new StringBuilder(c.getPath().toString()).append("String_Node_Str").append((activeGir instanceof TiledBufferedImage ? ((TiledBufferedImage)activeGir).getDescription() + "String_Node_Str" : "String_Node_Str")).toString();
      for (int j=0; j < max; j++) {
        if (j + h0 < 0) {
          continue;
        }
        for (int i=0; i < max; i++) {
          if (i + w0 < 0) {
            continue;
          }
          float ymin=(float)(((j + h0) * Constant.OVERVIEW_SIZE_DOUBLE - yy) / (height * zoom));
          float ymax=(float)(((j + h0 + 1) * Constant.OVERVIEW_SIZE_DOUBLE - yy) / (height * zoom));
          float xmin=(float)(((i + w0) * Constant.OVERVIEW_SIZE_DOUBLE - xx) / (1d * width * zoom));
          float xmax=(float)(((i + w0 + 1) * Constant.OVERVIEW_SIZE_DOUBLE - xx) / (1d * width * zoom));
          if (ymin > 1 || ymax < 0) {
            continue;
          }
          if (xmin > 1 || xmax < 0) {
            continue;
          }
          String file=new StringBuilder(initfile).append(getBandFolder(activeBand)).append("String_Node_Str").append((i + w0)).append("String_Node_Str").append((j + h0)).append("String_Node_Str").toString();
          Texture t=tryMemoryCache(gl,file,xmin,xmax,ymin,ymax);
          if (t == null) {
            BufferedImage tile=tryFileCache(gl,file,0,(i + w0),(j + h0),xmin,xmax,ymin,ymax);
            if (tile != null) {
              t=AWTTextureIO.newTexture(gl.getGLProfile(),tile,false);
              tcm.add(file,t);
            }
          }
          if (t != null) {
            bindTexture(gl,t,xmin,xmax,ymin,ymax);
          }
 else {
            addTileToQueue(initfile,0,(i + w0),(j + h0));
          }
        }
      }
    }
    displayDownloading(futures.size());
    SumoPlatform.getApplication().refresh();
    if (this.disposed) {
      disposeSync();
    }
  }
}