jdk/test/java/awt/image/GetSamplesTest.java
author bae
Wed, 29 Sep 2010 10:44:02 +0400
changeset 6631 8bb1126f01d3
child 8937 38ffd0c8fd2b
permissions -rw-r--r--
6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException Reviewed-by: igor, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6631
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     1
/*
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     4
 *
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     8
 *
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    13
 * accompanied this code).
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    14
 *
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    18
 *
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    21
 * questions.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    22
 */
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    23
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    24
/*
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    25
 * @test
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    26
 * @bug     6735275
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    27
 * @summary Test verifies that SampleModel.getSamples() throws an appropriate
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    28
 *           exception if coordinates are not in bounds.
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    29
 *
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    30
 * @run     main GetSamplesTest
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    31
 */
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    32
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    33
import java.awt.image.BandedSampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    34
import java.awt.image.ComponentSampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    35
import java.awt.image.DataBuffer;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    36
import java.awt.image.MultiPixelPackedSampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    37
import java.awt.image.PixelInterleavedSampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    38
import java.awt.image.SampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    39
import java.awt.image.SinglePixelPackedSampleModel;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    40
import java.util.Vector;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    41
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    42
public class GetSamplesTest {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    43
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    44
    public static int width = 100;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    45
    public static int height = 100;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    46
    public static int dataType = DataBuffer.TYPE_BYTE;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    47
    public static int numBands = 4;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    48
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    49
    public static void main(String[] args) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    50
        Vector<Class<? extends SampleModel>> classes = new Vector<Class<? extends SampleModel>>();
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    51
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    52
        classes.add(ComponentSampleModel.class);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    53
        classes.add(MultiPixelPackedSampleModel.class);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    54
        classes.add(SinglePixelPackedSampleModel.class);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    55
        classes.add(BandedSampleModel.class);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    56
        classes.add(PixelInterleavedSampleModel.class);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    57
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    58
        for (Class<? extends SampleModel> c : classes) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    59
            doTest(c);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    60
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    61
    }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    62
    private static void doTest(Class<? extends SampleModel> c) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    63
        System.out.println("Test for: " + c.getName());
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    64
        SampleModel sm = createSampleModel(c);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    65
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    66
        DataBuffer db = sm.createDataBuffer();
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    67
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    68
        int[] iArray = new int[ width * height + numBands];
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    69
        float[] fArray = new float[ width * height + numBands];
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    70
        double[] dArray = new double[ width * height + numBands];
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    71
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    72
        boolean iOk = false;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    73
        boolean fOk = false;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    74
        boolean dOk = false;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    75
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    76
        try {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    77
            sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, iArray, db);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    78
        } catch (ArrayIndexOutOfBoundsException e) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    79
            System.out.println(e.getMessage());
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    80
            iOk = true;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    81
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    82
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    83
        try {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    84
            sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, fArray, db);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    85
        } catch (ArrayIndexOutOfBoundsException e) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    86
            System.out.println(e.getMessage());
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    87
            fOk = true;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    88
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    89
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    90
        try {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    91
            sm.getSamples(0, Integer.MAX_VALUE, 1, 1, 0, dArray, db);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    92
        } catch (ArrayIndexOutOfBoundsException e) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    93
            System.out.println(e.getMessage());
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    94
            dOk = true;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    95
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    96
        if (!iOk || !fOk || !dOk) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    97
            throw new RuntimeException("Test for " + c.getSimpleName() +
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    98
                    " failed: iOk=" + iOk + "; fOk=" + fOk + "; dOk=" + dOk);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
    99
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   100
    }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   101
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   102
    private static SampleModel createSampleModel(Class<? extends SampleModel> cls) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   103
        SampleModel res = null;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   104
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   105
        if (cls == ComponentSampleModel.class) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   106
            res = new ComponentSampleModel(dataType, width, height, 4, width * 4, new int[] { 0, 1, 2, 3 } );
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   107
        } else if (cls == MultiPixelPackedSampleModel.class) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   108
            res = new MultiPixelPackedSampleModel(dataType, width, height, 4);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   109
        } else if (cls == SinglePixelPackedSampleModel.class) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   110
            res = new SinglePixelPackedSampleModel(dataType, width, height,
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   111
                    new int[]{ 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff });
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   112
        } else if (cls == BandedSampleModel.class) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   113
            res = new BandedSampleModel(dataType, width, height, numBands);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   114
        } else if (cls == PixelInterleavedSampleModel.class) {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   115
            res = new PixelInterleavedSampleModel(dataType, width, height, 4, width * 4, new int[] { 0, 1, 2, 3 });
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   116
        } else {
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   117
            throw new RuntimeException("Unknown class " + cls);
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   118
        }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   119
        return res;
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   120
    }
8bb1126f01d3 6735275: java.awt.image.SampleModel.getSamples() methods not allways throw ArrayIndexOutOfBoundsException
bae
parents:
diff changeset
   121
}