Do not create a new instance recursively for nothing to display the list of valid...
[Persons_Comparator.git] / 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());
         }
     }