JAL-4353 re-used random color code
[jalview.git] / src / jalview / util / ColorUtils.java
index e9c66bd..24128ea 100644 (file)
@@ -236,10 +236,7 @@ public class ColorUtils
 
     if ("random".equals(colour))
     {
-      Random rand = new Random();
-      col = new Color(rand.nextInt(256), rand.nextInt(256),
-              rand.nextInt(256));
-      return col;
+      return generateRandomColor(null);
     }
 
     try
@@ -267,7 +264,8 @@ public class ColorUtils
           int b = Integer.parseInt(tokens[2].trim());
           col = new Color(r, g, b);
         }
-      } catch (Exception ex)
+      } catch (IllegalArgumentException ex) // IllegalArgumentException includes
+                                            // NumberFormatException
       {
         // non-numeric token or out of 0-255 range
       }