Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-1164

Updating a configuration containing a property configured with unbound array size

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • webconsole-1.2.10
    • webconsole-2.0.0
    • Web Console
    • 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 )

      { vec.setSize( 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.

      Attachments

        Activity

          People

            fmeschbe Felix Meschberger
            fmeschbe Felix Meschberger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: