src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
changeset 48641 35b5da568499
parent 47972 18dbd2ae7eca
child 48645 6cfee3ad7a76
equal deleted inserted replaced
48640:42ad9a781f51 48641:35b5da568499
   736 
   736 
   737                 switch (chunkType) {
   737                 switch (chunkType) {
   738                 case IDAT_TYPE:
   738                 case IDAT_TYPE:
   739                     // If chunk type is 'IDAT', we've reached the image data.
   739                     // If chunk type is 'IDAT', we've reached the image data.
   740                     if (imageStartPosition == -1L) {
   740                     if (imageStartPosition == -1L) {
       
   741                         /*
       
   742                          * The PNG specification mandates that if colorType is
       
   743                          * PNG_COLOR_PALETTE then the PLTE chunk should appear
       
   744                          * before the first IDAT chunk.
       
   745                          */
       
   746                         if (colorType == PNG_COLOR_PALETTE &&
       
   747                             !(metadata.PLTE_present))
       
   748                         {
       
   749                             throw new IIOException("Required PLTE chunk"
       
   750                                     + " missing");
       
   751                         }
   741                         /*
   752                         /*
   742                          * PNGs may contain multiple IDAT chunks containing
   753                          * PNGs may contain multiple IDAT chunks containing
   743                          * a portion of image data. We store the position of
   754                          * a portion of image data. We store the position of
   744                          * the first IDAT chunk and continue with iteration
   755                          * the first IDAT chunk and continue with iteration
   745                          * of other chunks that follow image data.
   756                          * of other chunks that follow image data.