undefined getChannel

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

rsnail
Posts: 33
Joined: 04 Nov 2005, 20:19

undefined getChannel

Postby rsnail » 17 Jan 2006, 23:32

Any ideas what might cause an undefined getChannel it only happens once every couple users. Shouldn't the getChannel always work if the user is online?

2006/01/17 17:28:35.163 - [ WARNING ] [id: 11] (JavascriptExtension.logASError): Error in extension [ server.as ]: TypeError: Cannot call method "getChannel" of undefined (server.as#401) Line: -514 (MainLib line: 401)

Thanks

rsnail
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Jan 2006, 06:16

Just from the error is not very easy to tell.
The code from the mainlib.as is this:

Code: Select all

else if (userList.length > 0 && response != undefined)
{
   var list = new java.util.LinkedList()

   for (var i in userList)
   {
      list.add(userList[i].getChannel())
   }
   
   __extension.sendResponse(result, fromRoom, u, list)
}


It basically just loops through the userList array and calls the getChannel() method.
The error could be thrown because some other object was erroneously added to the list or because the User has been disconnected and its not available anymore.

Question: did you by chance add new methods to the array prototype?
Like:

Code: Select all

Array.prototype.myMethod = function()
{
    // whatever ...
}


This could be a reason too...
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Jan 2006, 06:20

One more thing. If you want to debug what's going on from inside the mainlib.as you could modify the code starting from line 395 like this:

Code: Select all

else if (userList.length > 0 && response != undefined)
{
   var list = new java.util.LinkedList()

   for (var i in userList)
   {
      var u = userList[i]

      if (u.getChannel == undefined)
          trace("found non-User object at " + i + " type: " + typeof u)
      else
          list.add(u.getChannel())
   }
   
   __extension.sendResponse(result, fromRoom, u, list)
}
Lapo

--

gotoAndPlay()

...addicted to flash games
rsnail
Posts: 33
Joined: 04 Nov 2005, 20:19

Postby rsnail » 18 Jan 2006, 15:33

Hello,

Nope, I did not add new methods to the array prototype.

I am using the getUserByChannel() after the loginUser() in an extension, so I can notify the user what their id is, and set a couple user.properties.

Most logins do not show this error, only 1 out of a 100.

I'll add a couple more logging messages to the mainLib.as to track down if it is the same user, or if the user lost connection during login.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 32 guests