felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] Closed: (FELIX-1164) Updating a configuration containing a property configured with unbound array size
Date Mon, 18 May 2009 06:10:45 GMT

     [ https://issues.apache.org/jira/browse/FELIX-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Felix Meschberger closed FELIX-1164.

    Resolution: Fixed

Applied fix in Rev. 775823.

> Updating a configuration containing a property configured with unbound array size
> ---------------------------------------------------------------------------------
>                 Key: FELIX-1164
>                 URL: https://issues.apache.org/jira/browse/FELIX-1164
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>    Affects Versions: webconsole-1.2.10
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: webconsole-1.2.12
> 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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message