[Red5devs] Serverside cast problems with remote shared objects

Valentin Manthei mail at valentin-manthei.de
Wed May 21 08:22:22 PDT 2008


Finally I found my mistake: Somewhere in the ActionScript code there was 
still a call like so.setProperty("so_name", new Array()) that converted 
the RSO to another type (HashMap, ArrayList).

But eventually this topic is helpful for someone looking for a code 
example how to realize complex RSO storage in a webapp.

Best regards,
Valentin

Valentin Manthei schrieb:
> Hi everybody.
>
> I currently have some problems with handling my remote shared objects in
> my webapp.
>
> I save the rso attributes as an ArrayList but when I operated with them
> sometimes (not frequently) ClassCastExceptions occurred.
> -> java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast
> to java.util.ArrayList
>
> Some code snippets:
> Adding an user:
> ArrayList<String> vl = (ArrayList) viewerList.getAttribute("rso_name");
> if(vl == null) {
>    vl = new ArrayList<String>();
> }
> vl.add("username");
>
> Removing an user:
> ArrayList<String> vl = new ArrayList<String>();
> vl = (ArrayList) viewerList.getAttribute("rso_name");
> if(vl != null) {
>     int listsize = vl.size();
>     if(listsize > 0) {
>         for(int i=0; i<listsize; i++) {
>             if(vl.get(i).substring(0,
> vl.get(i).indexOf("/")).equals(viewer)) {
>                 vl.remove(i);
>                 break;
>             }
>         }
>     }
>     viewerList.beginUpdate();
>     viewerList.setAttribute(broadcaster, vl);
>     viewerList.endUpdate();
> }
>
> I also experimented with storing the rso data in a HashMap but in this
> case he told me the cast from ArrayList to HashMap cannot be done. What
> the hell? ;-)
>
> Im not sure if thats a red5 or a Java problem, but i hope someone can
> help me out of it.
>
> Best regards,
> Valentin
>
>
> _______________________________________________
> Red5devs mailing list
> Red5devs at osflash.org
> http://osflash.org/mailman/listinfo/red5devs_osflash.org
>
>   




More information about the Red5devs mailing list