This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 9b5ac8dd9389f6794467849e7d621e07e6c99065 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue May 16 11:17:40 2023 -0400 Normalized some exception messages --- .../common/itu_t4/BitInputStreamFlexible.java | 4 ++-- .../imaging/formats/tiff/TiffImageParser.java | 24 +++++++++++----------- .../apache/commons/imaging/palette/ColorGroup.java | 2 +- .../imaging/palette/MedianCutQuantizer.java | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/common/itu_t4/BitInputStreamFlexible.java b/src/main/java/org/apache/commons/imaging/common/itu_t4/BitInputStreamFlexible.java index e3d35d6c..8fbd415d 100644 --- a/src/main/java/org/apache/commons/imaging/common/itu_t4/BitInputStreamFlexible.java +++ b/src/main/java/org/apache/commons/imaging/common/itu_t4/BitInputStreamFlexible.java @@ -77,7 +77,7 @@ class BitInputStreamFlexible extends FilterInputStream { while (count >= 8) { cache = in.read(); if (cache < 0) { - throw new ImagingException("couldn't read bits"); + throw new ImagingException("Couldn't read bits"); } // System.out.println("cache 1: " + cache + " (" // + Integer.toHexString(cache) + ", " @@ -89,7 +89,7 @@ class BitInputStreamFlexible extends FilterInputStream { if (count > 0) { cache = in.read(); if (cache < 0) { - throw new ImagingException("couldn't read bits"); + throw new ImagingException("Couldn't read bits"); } // System.out.println("cache 2: " + cache + " (" // + Integer.toHexString(cache) + ", " diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java index 7aa05fc6..d24606d7 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java @@ -263,22 +263,22 @@ public class TiffImageParser extends ImageParser<TiffImagingParameters> implemen // Check for valid subimage specification. The following checks // are consistent with BufferedImage.getSubimage() if (subImage.width <= 0) { - throw new ImagingException("negative or zero subimage width"); + throw new ImagingException("Negative or zero subimage width."); } if (subImage.height <= 0) { - throw new ImagingException("negative or zero subimage height"); + throw new ImagingException("Negative or zero subimage height."); } if (subImage.x < 0 || subImage.x >= width) { - throw new ImagingException("subimage x is outside raster"); + throw new ImagingException("Subimage x is outside raster."); } if (subImage.x + subImage.width > width) { - throw new ImagingException("subimage (x+width) is outside raster"); + throw new ImagingException("Subimage (x+width) is outside raster."); } if (subImage.y < 0 || subImage.y >= height) { - throw new ImagingException("subimage y is outside raster"); + throw new ImagingException("Subimage y is outside raster."); } if (subImage.y + subImage.height > height) { - throw new ImagingException("subimage (y+height) is outside raster"); + throw new ImagingException("Subimage (y+height) is outside raster."); } } @@ -791,22 +791,22 @@ public class TiffImageParser extends ImageParser<TiffImagingParameters> implemen // Check for valid subimage specification. The following checks // are consistent with BufferedImage.getSubimage() if (subImage.width <= 0) { - throw new ImagingException("negative or zero subimage width"); + throw new ImagingException("Negative or zero subimage width."); } if (subImage.height <= 0) { - throw new ImagingException("negative or zero subimage height"); + throw new ImagingException("Negative or zero subimage height."); } if (subImage.x < 0 || subImage.x >= width) { - throw new ImagingException("subimage x is outside raster"); + throw new ImagingException("Subimage x is outside raster."); } if (subImage.x + subImage.width > width) { - throw new ImagingException("subimage (x+width) is outside raster"); + throw new ImagingException("Subimage (x+width) is outside raster."); } if (subImage.y < 0 || subImage.y >= height) { - throw new ImagingException("subimage y is outside raster"); + throw new ImagingException("Subimage y is outside raster."); } if (subImage.y + subImage.height > height) { - throw new ImagingException("subimage (y+height) is outside raster"); + throw new ImagingException("Subimage (y+height) is outside raster."); } // if the subimage is just the same thing as the whole diff --git a/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java b/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java index cedac1c4..dee0a3fd 100644 --- a/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java +++ b/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java @@ -53,7 +53,7 @@ class ColorGroup { this.ignoreAlpha = ignoreAlpha; if (colorCounts.isEmpty()) { - throw new ImagingException("empty color_group"); + throw new ImagingException("Empty color_group"); } int total = 0; diff --git a/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java b/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java index b7424114..1b816a7a 100644 --- a/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java +++ b/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java @@ -132,7 +132,7 @@ public class MedianCutQuantizer { colorGroup.paletteIndex = i; if (colorGroup.getColorCounts().isEmpty()) { - throw new ImagingException("empty color_group: " + throw new ImagingException("Empty color_group: " + colorGroup); } }