Do not create a new instance recursively for nothing to display the list of valid...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 12 Jan 2019 11:22:23 +0000 (12:22 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 12 Jan 2019 11:22:23 +0000 (12:22 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/Eye.java

index 6b71f354d6cd9e3d8a7bb043680efda045a1b573..59612440812c342dd6dd929b91936de79363d337 100644 (file)
@@ -27,7 +27,7 @@ public class Eye implements Comparable<Eye> {
         if (validateColor(strColor)) {
             this.strColor = strColor;
         } else {
-            throw new IllegalArgumentException("Color must be" + new Eye().colorListToString());
+            throw new IllegalArgumentException("Color must be" + this.colorListToString());
         }
     }
 
@@ -51,9 +51,8 @@ public class Eye implements Comparable<Eye> {
                 this.color = new Color(88, 41, 0);
             else
                 this.color = Color.getColor(color);
-
         } else {
-            throw new IllegalArgumentException("Color must be" + new Eye().colorListToString());
+            throw new IllegalArgumentException("Color must be" + this.colorListToString());
         }
     }