Problem sending back BasicMap to the server

198 views
Skip to first unread message

Althor

unread,
Mar 6, 2012, 6:40:52 AM3/6/12
to gran...@googlegroups.com
Hi
I am having problems to send a actionscript object wich contains a IMap to the server.

My java class contains this attribute:
 private Map<String, AttributeData> attributes = new HashMap<String, AttributeData>();

The generated AS class is:
package model.dto {

    import flash.utils.IDataInput;
    import flash.utils.IDataOutput;
    import flash.utils.IExternalizable;
    import org.granite.collections.IMap;

    [Bindable]
    public class AbstractBaseLdapDataBase implements IExternalizable {

        private var _attributes:IMap;
        private var _entryDN:String;

        public function set attributes(value:IMap):void {
            _attributes = value;
        }
        public function get attributes():IMap {
            return _attributes;
        }

        public function get entryDN():String {
            return _entryDN;
        }

        public function readExternal(input:IDataInput):void {
            _attributes = input.readObject() as IMap;
            _entryDN = input.readObject() as String;
        }

        public function writeExternal(output:IDataOutput):void {
            output.writeObject(_attributes);
            output.writeObject(_entryDN);
        }
    }
}


In the AS that I am able to modify I have added the following code to initialize the 'attributes' attribute:
public function AbstractBaseLdapData() {
            this.attributes=new BasicMap();
        }


My problem comes where I create a new object in flex and send it to the server. I am getting this exception:
Caused by: org.granite.messaging.amf.io.convert.NoConverterFoundException: Cannot convert: org.granite.collections.BasicMap {vfesmangsmaid=[Ljava.lang.Object;@b455e0, vfesmanid=[Ljava.lang.Object;@1721198} to: java.util.HashMap<java.lang.String, model.dto.AttributeData>
        at org.granite.messaging.amf.io.convert.Converters.getConverter(Converters.java:119)
        at org.granite.messaging.amf.io.convert.Converters.convert(Converters.java:132)
        at org.granite.messaging.amf.io.util.Property.convert(Property.java:60)
        at org.granite.messaging.amf.io.util.FieldProperty.setProperty(FieldProperty.java:60)


The externalizer I am using is DefaultExternalizer.

When the server sends objects to the flex client the serialization and deserialization work success.

Can you help me?
Thanks in advance!

Dahn Maier

unread,
Mar 7, 2012, 7:26:53 AM3/7/12
to gran...@googlegroups.com
Have you tried initializing the map on the client side with a PersistentMap instead?

this.attributes = new PersistentMap() ;

Althor

unread,
Mar 7, 2012, 7:30:35 AM3/7/12
to gran...@googlegroups.com
Hi
I've discovered my mistake. I was put bad values in my Map.
Now it works fine!
Reply all
Reply to author
Forward
0 new messages