General clean-up

This commit is contained in:
Harald Kuhr 2021-03-27 14:37:11 +01:00
parent db782cfe9e
commit 3b34d6e7ce
3 changed files with 8 additions and 7 deletions

View File

@ -346,7 +346,7 @@ public final class FileUtil {
/** /**
* Gets the file (type) extension of the given file. * Gets the file (type) extension of the given file.
* A file extension is the part of the filename, after the last occurence * A file extension is the part of the filename, after the last occurrence
* of a period {@code '.'}. * of a period {@code '.'}.
* If the filename contains no period, {@code null} is returned. * If the filename contains no period, {@code null} is returned.
* *

View File

@ -1631,12 +1631,14 @@ public abstract class ImageReaderAbstractTest<T extends ImageReader> {
BufferedImage one = reader.read(0); BufferedImage one = reader.read(0);
BufferedImage two = reader.read(0); BufferedImage two = reader.read(0);
// Test for same BufferedImage instance
assertNotSame("Multiple reads return same (mutable) image", one, two); assertNotSame("Multiple reads return same (mutable) image", one, two);
one.setRGB(0, 0, Color.BLUE.getRGB()); // Test for same backing storage (array)
two.setRGB(0, 0, Color.RED.getRGB()); one.setRGB(0, 0, Color.BLACK.getRGB());
two.setRGB(0, 0, Color.WHITE.getRGB());
assertTrue(one.getRGB(0, 0) != two.getRGB(0, 0)); assertTrue(one.getRGB(0, 0) != two.getRGB(0, 0));
reader.dispose(); reader.dispose();
} }

View File

@ -150,7 +150,6 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
else { else {
if (marker == JPEG.EOI) { if (marker == JPEG.EOI) {
segment = new Segment(marker, realPosition, segment.end(), 2); segment = new Segment(marker, realPosition, segment.end(), 2);
segments.add(segment);
} }
else { else {
// Length including length field itself // Length including length field itself
@ -165,6 +164,7 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
// Inspect segment, see if we have 16 bit precision (assuming segments will not contain // Inspect segment, see if we have 16 bit precision (assuming segments will not contain
// multiple quality tables with varying precision) // multiple quality tables with varying precision)
int qtInfo = stream.read(); int qtInfo = stream.read();
if ((qtInfo & 0x10) == 0x10) { if ((qtInfo & 0x10) == 0x10) {
processWarningOccured("16 bit DQT encountered"); processWarningOccured("16 bit DQT encountered");
segment = new DownsampledDQTReplacement(realPosition, segment.end(), length, qtInfo, stream); segment = new DownsampledDQTReplacement(realPosition, segment.end(), length, qtInfo, stream);
@ -188,10 +188,9 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
else { else {
segment = new Segment(marker, realPosition, segment.end(), length); segment = new Segment(marker, realPosition, segment.end(), length);
} }
segments.add(segment);
} }
segments.add(segment);
currentSegment = segments.size() - 1; currentSegment = segments.size() - 1;
if (marker == JPEG.SOS) { if (marker == JPEG.SOS) {