Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6427331

NullPointerException in LookupOp.filter(Raster, WritableRaster)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.1, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • Resolved In Build:
      b131
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.4.2_10"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)

      also in: 1.3.1_17, 1.5.0_06 and 6beta

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      A call to java.awt.image.LookupOp.filter(Raster src, WritableRaster dest) when dest is null results in a NullPointerException in the second line("int dstLength = dst.getNumBands();"). According to Javadocs passing in null is allowed and the source code of the method seems to indicate that it is supposed to be allowed. dst.getNumBands() should be called only after "dst" has been verified to be non-null.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The description above should suffice to reproduce.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The filter() method should create a compatible destination raster before getNumBands() is called on the "dst" variable, i.e. no NPE should occur.
      ACTUAL -
      A NullPointerException on the second line in the LookupOp.filter(Raster, WritableRaster) method.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException
      at java.awt.image.LookupOp.filter(LookupOp.java:238)
      (under JDK 1.4.2_10)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Do I really need to provide that for such a simple problem? The problem can be seen by pure static code analysis.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Creat the "dst" WritableRaster yourself and pass it in as the "dst" parameter.

        Attachments

          Activity

            People

            Assignee:
            aghaisas Ajit Ghaisas
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: