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
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
}