You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/08/31 14:04:26 UTC

[commons-imaging] branch master updated (0b467258 -> fec02689)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


    from 0b467258 Bump commons-parent from 59 to 61
     new 7cd0f629 Fail fast in org.apache.commons.imaging.palette.ColorCountComparator.ColorCountComparator(ColorComponent)
     new eb864e6c Throw IllegalArgumentException instead of Error
     new f20daa37 Throw IllegalArgumentException instead of Error
     new 1646a09c Throw IllegalArgumentException instead of Error
     new fec02689 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-imaging.git

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/imaging/palette/ColorCountComparator.java     | 5 ++++-
 .../org/apache/commons/imaging/palette/LongestAxisMedianCut.java     | 2 +-
 .../java/org/apache/commons/imaging/palette/MedianCutQuantizer.java  | 2 +-
 .../apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java  | 2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)


[commons-imaging] 03/05: Throw IllegalArgumentException instead of Error

Posted by gg...@apache.org.
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 f20daa37871f3313cf812e1c83760a6b5efb1830
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 31 09:57:27 2023 -0400

    Throw IllegalArgumentException instead of Error
---
 .../java/org/apache/commons/imaging/palette/MedianCutQuantizer.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 868188ba..a758fb73 100644
--- a/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java
+++ b/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java
@@ -47,7 +47,7 @@ public class MedianCutQuantizer {
                 return result;
             }
         }
-        throw new Error("");
+        throw new IllegalArgumentException();
     }
 
     private Map<Integer, ColorCount> groupColors1(final BufferedImage image, final int max,


[commons-imaging] 02/05: Throw IllegalArgumentException instead of Error

Posted by gg...@apache.org.
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 eb864e6cb3bc66f3348861b65540711cfee9b87e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 31 09:30:42 2023 -0400

    Throw IllegalArgumentException instead of Error
---
 .../java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java b/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
index 8bc06bab..4801e95f 100644
--- a/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
+++ b/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
@@ -88,7 +88,7 @@ public class LongestAxisMedianCut implements MedianCut {
                 limit = medianValue.blue;
                 break;
             default:
-                throw new Error("Bad mode.");
+                throw new IllegalArgumentException("Bad mode " + mode);
         }
         colorGroup.cut = new ColorGroupCut(less, more, mode, limit);
     }


[commons-imaging] 01/05: Fail fast in org.apache.commons.imaging.palette.ColorCountComparator.ColorCountComparator(ColorComponent)

Posted by gg...@apache.org.
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 7cd0f629fa317f02465cbee309648774ce6b56b1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 31 09:30:27 2023 -0400

    Fail fast in
    org.apache.commons.imaging.palette.ColorCountComparator.ColorCountComparator(ColorComponent)
---
 .../org/apache/commons/imaging/palette/ColorCountComparator.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/palette/ColorCountComparator.java b/src/main/java/org/apache/commons/imaging/palette/ColorCountComparator.java
index 22456a46..62308b42 100644
--- a/src/main/java/org/apache/commons/imaging/palette/ColorCountComparator.java
+++ b/src/main/java/org/apache/commons/imaging/palette/ColorCountComparator.java
@@ -18,6 +18,7 @@ package org.apache.commons.imaging.palette;
 
 import java.io.Serializable;
 import java.util.Comparator;
+import java.util.Objects;
 
 /**
  * A comparator for {#link ColorCount} elements.
@@ -33,14 +34,16 @@ import java.util.Comparator;
  * @since 1.0-alpha2
  */
 public class ColorCountComparator implements Comparator<ColorCount>, Serializable {
+
     private static final long serialVersionUID = 1L;
+
     /**
      * Color component used during the comparison.
      */
     private final ColorComponent colorComponent;
 
     public ColorCountComparator(final ColorComponent colorComponent) {
-        this.colorComponent = colorComponent;
+        this.colorComponent = Objects.requireNonNull(colorComponent, "colorComponent");
     }
 
     @Override


[commons-imaging] 05/05: Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-imaging.git

Posted by gg...@apache.org.
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 fec026893cec672ab1abf0e194cf8a3c21e2d983
Merge: 1646a09c 0b467258
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 31 10:04:08 2023 -0400

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-imaging.git

 pom.xml                 | 2 +-
 src/changes/changes.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


[commons-imaging] 04/05: Throw IllegalArgumentException instead of Error

Posted by gg...@apache.org.
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 1646a09c5316302356febadf7375acdfd6bf9d06
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 31 10:03:59 2023 -0400

    Throw IllegalArgumentException instead of Error
---
 .../org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java b/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
index dbe133a7..30566df4 100644
--- a/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
+++ b/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
@@ -125,7 +125,7 @@ public class MostPopulatedBoxesMedianCut implements MedianCut {
                 limit = medianValue.blue;
                 break;
             default:
-                throw new Error("Bad mode.");
+                throw new IllegalArgumentException("Bad mode: " + bestColorComponent);
         }
         colorGroup.cut = new ColorGroupCut(lowerGroup, upperGroup, bestColorComponent, limit);
         return true;