Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
webconsole-1.2.10
-
None
Description
To configure a property to be stored as an unbounded array, the cardinality of the property must be configured as Integer.MIN_VALUE in the metatype definition. This may cause a failure to update such a configuration in the ConfigManager class where the following construct is used to check whether the temporary vector must be resized:
int maxSize = Math.abs( ad.getCardinality() );
if ( vec.size() > maxSize )
The problem is that Math.abs(Integer.MIN_VALUE) is still Integer.MIN_VALUE and thus negative (see also the Javadoc of the Math.abs(int) method). This causes the test to pass but calling Vector.setSize(int) with a negative value causes an ArrayIndexOutOfBoundsException.
The fix is to ensure the maxSize is not negative before resetting the size. Since the negative value in this case means "unbounded" anyway, we can safely skip resizing the vector.