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

Object type checks fail when objects are loaded with BlazeDS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • Adobe Flex SDK 3.1 (Release)
    • None
    • mx: General
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Browser: Firefox 2.x
      Language Found: English

    Description

      Steps to reproduce:
      1. Create an interface as follows:

      public interface IMyInterface
      {
      function get selected():Boolean;
      }

      2. Create a class that implements the interface

      package com.mycompany.myproduct
      {
      [Bindable]
      [RemoteClass(alias="com.mycompany.myproduct.MyClass")]
      public class MyClass implements IMyInterface
      {
      public var _myVar:Boolean;

      public function get selected():Boolean

      { return this._myVar; }

      }
      }

      3. Load an object of MyClass using BlazeDS

      var myObject:MyClass;
      var service:RemoteObject = new RemoteObject("myService");
      var token:AsyncToken = service.myMethod();
      token.addResultHandler(this.handleSuccess);

      4. Check if the return value from the BlazeDS call implements IMyInterface

      function handleSuccess(data:Object):void
      {
      var result:Boolean = data is IMyInterface;
      }

      Actual Results:
      (data is IMyInterface) returns false.

      Expected Results:
      (data is IMyInterface) must return true.

      Workaround (if any):
      flash.utils.describeType(myObject) returns

      <type name="Object" ...

      rather than

      <type name="MyClass" ..

      as would be expected.

      Changing (data is IMyInterface) to (data is MyClass) returns true.

      (var myObject:MyClass = new MyClass()) and then checking (myObject is IMyInterface) returns true as well. It seems that if an object is created via the new() operator within the Flex client, the type checking code works fine. However, if the object is loaded from a remote server call, the type checking code fails.

      Environment:
      Operating system: Microsoft Windows XP Professional with SP2
      Flex SDK: 3.1.0
      Java: Sun JDK 1.5 patch 14

      I could have logged this under BlazeDS but I am not sure whether this is a Flex SDK problem or a BlazeDS problem. I need to urgently develop some ItemRenderers that depend exclusively on checking whether the items sent to the ItemRenderer are of the IMyInterface so that I can take special action on those items.

      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: