Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-27013

GridItemEditor's save method doesn't introspect type correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Adobe Flex SDK Previous
    • None
    • Spark: Grid
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Steps to reproduce:
      1. Run the attached FXP
      2. Try to change the Number value in the top left cell to a number with a decimal (like 1.1)

      Actual Results:
      Watch as the DataGrid rounds the Number to a uint

      Expected Results:
      No rounding should happen.

      Workaround (if any):
      Drink more beer.

      Details of the problem:
      For some reason if a Number is set to a whole number (no decimal place) then calling "num is uint" returns true. Calling "num is Number" also returns true. In the GridItemEditor's save method, if the type of an object can't be introspected with describeType, then it will check if the value is a uint (and int) before it checks if it's a Number. Even though it's really a Number, the GridItemEditor will cast the value to a uint because Flash Player wrongly said it was a uint.

      This problem is exacerbated because the call to describeType only checks variables, not accessors. On a Bindable object the variables are turned into accessors at compile time.

      Suggestions to fix this:
      First, it seems like a bug in Flash Player that it says a Number is a uint even when it's definitely defined as a Number. But since that's probably not going to change any time soon, there are a few other ways to deal with this. GridItemEditor's save method should also check the describeType's accessors for the typeInfo of the property. Also, it might be good to change the order of the typeInfo check. Putting Number before uint and int would work.

      Also, I believe that the save method should use the describeTypeCache instead of just describeType. That will slightly improve performance on subsequent saves.

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: