Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-58

[configuration] Wrong primitive conversion in DataConfiguration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1
    • None
    • None
    • Operating System: All
      Platform: All

    • 33524

    Description

      The values in getLongArray(), getFloatArray() and getDoubleArray() are not
      converted to the right type, they are all converted into integers.

      Index: DataConfiguration.java
      ===================================================================
      — DataConfiguration.java (revision 153417)
      +++ DataConfiguration.java (working copy)
      @@ -825,7 +826,7 @@
      Iterator it = values.iterator();
      while (it.hasNext())

      { - array[i++] = PropertyConverter.toLong(it.next()).intValue(); + array[i++] = PropertyConverter.toLong(it.next()).longValue(); }

      }
      else
      @@ -834,7 +835,7 @@

      { // attempt to convert a single value array = new long[1]; - array[0] = PropertyConverter.toLong(value).intValue(); + array[0] = PropertyConverter.toLong(value).longValue(); }

      catch (ConversionException e)
      {
      @@ -974,7 +975,7 @@
      Iterator it = values.iterator();
      while (it.hasNext())

      { - array[i++] = PropertyConverter.toFloat(it.next()).intValue(); + array[i++] = PropertyConverter.toFloat(it.next()).floatValue(); }

      }
      else
      @@ -983,7 +984,7 @@

      { // attempt to convert a single value array = new float[1]; - array[0] = PropertyConverter.toFloat(value).intValue(); + array[0] = PropertyConverter.toFloat(value).floatValue(); }

      catch (ConversionException e)
      {
      @@ -1124,7 +1125,7 @@
      Iterator it = values.iterator();
      while (it.hasNext())

      { - array[i++] = PropertyConverter.toDouble(it.next()).intValue(); + array[i++] = PropertyConverter.toDouble(it.next()).doubleValue(); }

      }
      else
      @@ -1133,7 +1134,7 @@

      { // attempt to convert a single value array = new double[1]; - array[0] = PropertyConverter.toDouble(value).intValue(); + array[0] = PropertyConverter.toDouble(value).doubleValue(); }

      catch (ConversionException e)
      {

      Attachments

        Activity

          People

            Unassigned Unassigned
            ebourg Emmanuel Bourg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: