Java Color creation throws IllegalArgumentException when used with integer arguments
colors, exception, java, spring
Solution
I'm NOT an expert with spring. but did you tried to set the type to int ?
<constructor-arg type="int" value="133">
?
Problem
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> ```