can't find Zone.getRoom method

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

Moderators: Lapo, Bax

Post Reply
endquote
Posts: 35
Joined: 29 Dec 2006, 00:39
Location: Seattle, WA
Contact:

can't find Zone.getRoom method

Post by endquote »

I'm occasionally getting the following stack trace from Smartfox 1.5.5:

Code: Select all

org.mozilla.javascript.EvaluatorException: Can't find method it.gotoandplay.smartfoxserver.data.Zone.getRoom(org.mozilla.javascript.Undefined). (Slasher2.js#1503)
        at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:95)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:978)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1034)
        at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:997)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:158)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:64)
        at org.mozilla.javascript.gen.c1._c70(Slasher2.js:1503)
        at org.mozilla.javascript.gen.c1._c47(Slasher2.js:916)
        at org.mozilla.javascript.gen.c1.call(Slasher2.js)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
        at org.mozilla.javascript.gen.c1.call(Slasher2.js)
        at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.callJavaScriptFunction(JavascriptExtension.java:443)
        at it.gotoandplay.smartfoxserver.extensions.JavascriptExtension.handleInternalEvent(JavascriptExtension.java:186)
        at it.gotoandplay.smartfoxserver.controllers.MessageHandler.dispatchEvent(MessageHandler.java:198)
        at it.gotoandplay.smartfoxserver.controllers.SystemHandler.broadcastUserLost(SystemHandler.java:3002)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.lostConnection(SmartFoxServer.java:1476)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.readIncomingMessages(SmartFoxServer.java:933)
        at it.gotoandplay.smartfoxserver.EventReader.run(EventReader.java:32)
        at java.lang.Thread.run(Thread.java:613)
The only place in my code where Zone.getRoom() is called within handleInternalEvent when handling the userLost event, which seems to agree with the stack trace (SmartFoxServer.lostConnection).

Code: Select all

var room = _server.getCurrentZone().getRoom(event.roomIds[0]);
These seems to happen randomly. Is there any explanation?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

the explanation is that you're passing an undefined as the argument to the method, and the java runtime complains about the fact that it doesn't exist a getRoom() method wich accepts an undefined value instead of an int
This is because getRoom is a Java method.
You should make sure that the passed value is != undefined
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply