kevoree-modeling / framework

The Kevoree Modeling Framework
http://modeling.kevoree.org
GNU General Public License v3.0
42 stars 6 forks source link

Index issue in JS #22

Open lmouline opened 8 years ago

lmouline commented 8 years ago

Take my favorite example, a Parking :

class kmf.test.Park {
    att name : String with index
}

I have a simple Java code which create a Park, save the model and open a websocket on the port 8083.

I have also a simple html file that contains the following JS script:

model.lookup(0,0,1,function(park){
            console.log(park.toJSON());

            model.findAll(kmf.test.meta.MetaPark.getInstance(),0,0,function(kPark){
                console.log(kPark[0].toJSON());
            })
        });

As output I have :

{"universe":0,"time":0,"uuid":1,"data":{"name":"Parkl"}}
Uncaught TypeError: Cannot read property 'index' of null

This exception occurs on this line of my "JS API" file:

ArrayLongLongMap.prototype.init = function (payload, metaModel, metaClassIndex) {
[...]
if (payload.charAt(cursor) == ',') {
      this._metaClassIndex = metaModel.metaClassByName(payload.substring(initPos, cursor)).index();
      cursor++;
      initPos = cursor;
}
[...]

If I remember correctly, I had a similar error in Java when I tried to access an indexed class without index attribute.