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

Doc probs in java.awt.image.MultiPixelPackedSampleModel

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: docs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: naC79102 Date: 11/23/2000


      Several methods in java.awt.image.MultiPixelPackedSampleModel state that
      "An ArrayIndexOutOfBoundsException
      might be thrown if the coordinates are not in bounds." but the actual
      algorithm to reproduce the condition which
      will produce this Exception is not mentioned.
      Exception is not thrown when x,y < 0, but when y*scanlineStride +
      x*pixelStride + bandOffsets[band] < 0.




      Sample code follows....
      package
      javasoft.sqe.tests.api.java.awt.java2d.image.MultiPixelPackedSampleModel;


      import java.awt.image.MultiPixelPackedSampleModel;
      import java.awt.image.DataBufferInt;
      import java.awt.image.DataBuffer;

      public class test {
      public test() {

       MultiPixelPackedSampleModel csm = new MultiPixelPackedSampleModel(
         DataBuffer.TYPE_BYTE,5,5,1,5,
                  new int[]{0,1,2});
          DataBufferInt db = new DataBufferInt(4000,2);
          int b = 5;

         try {
        // x<0
               csm.setSample(-1,25,1,b,db);
               System.out.println("No Exception. ");
         } catch (Exception e) {
           System.out.println("Caught "+e);
         }

         try {
        // y<0
               csm.setSample(25,-1,1,b,db);
               System.out.println("No Exception. ");
         } catch (Exception e) {
           System.out.println("Caught "+e);
         }

         try {
        // y*scanlineStride + x*pixelStride + bandOffsets[b] < 0
         csm.setSample(-1,-1,1,b,db);
         System.out.println("No Exception. ");
       } catch (Exception e) {
        System.out.println("Caught "+e);
       }





      }

      public static void main(String[] args) {
              new test();
      }
      }
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              sharonz Sharon Zakhour (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: