swingx-ws
  1. swingx-ws
  2. SWINGX_WS-13

Patch for fixing a NullPointerException in class TileCache

    Details

    • Type: Task Task
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: initial
    • Fix Version/s: 1.1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      13

      Description

      If heap memory runs short, an OutOfMemoryError exception is thrown which is then
      caught in the AbstractTileFactory. There the function needMoreMemory() from the
      class TileCache is called which should clear out all buffered images. Because
      not all internal data structure elements are reseted, a NullPointerException
      could be thrown later on in the function addToImageCache(...): This is because
      there are still elements in the access queue which are used to get the elements
      in the hashmap if imagesize is bigger than 1000 * 1000 * 50. But because the
      hashmap has been cleared in the needMoreMemory function, null will be returned
      and oldimg.getWidth() in line 109 leads to a NullPointerException.

      To fix that nasty bug the function needMoreMemory() in class
      org.jdesktop.swingx.mapviewer.TileCache must be extended with the following two
      lines of code:

      imgmapAccessQueue.clear();
      imagesize = 0;

      So the final function should look like this:

      public void needMoreMemory() {
      imgmapAccessQueue.clear();
      imgmap.clear();
      imagesize = 0;
      p("HACK! need more memory: freeing up memory");
      }

        Activity

        Hide
        rah003 added a comment -

        Bumped to the next version.

        Show
        rah003 added a comment - Bumped to the next version.

          People

          • Assignee:
            swingx-ws-issues
            Reporter:
            freeax
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: