The following code when executed on certain machines in our company causes an IllegalArgumentException
to be thrown:
Color sludge = new Color(133, 133, 78);
//throws IAE with message "Color parameter outside of expected range: Red Green Blue"
An equivalent call using float
arguments instead works:
Color sludge = new Color(0.522, 0.522, 0.306); // 133/255 = 0.522, 78/255 = 0.306
Why might this be the case? And why would it only affect certain machines?
Might it have something to do with the fact that these Color
objects are defined in Spring like this:
<bean id="sludge" class="java.awt.Color">
<constructor-arg value="133"/>
<constructor-arg value="133"/>
<constructor-arg value="78"/>
</bean>