📜 ⬆️ ⬇️

Error - class names match

Recently, I spent almost a whole day searching for one mistake. Maybe someone will benefit from my experience.

So, the situation. The structure of the system is approximately as follows. There is a SWF (let's call it a loader), which loads other SWFs (let's call them modules). One of the modules I am working on loads, in turn, another SWF - let's call it a game. The loader is written by one programmer, the game is by another programmer, but the module is me. The layout is quite typical for the development of virtual worlds.

Running the whole complex on a developer’s machine is a chore and problematic, since the bootloader is tied to many things on the server. Therefore, I usually test only the module in conjunction with the game, especially since the interaction with the loader is minimized and worked out long ago. I run the module locally - everything works fine. The game is loaded, the module brings it to some interface, calls methods - in short, all the way through. I upload to the server and get an error. It quickly becomes clear that the error occurs because it is not possible to bring the loaded object to the required interface.
')
I assumed that an error occurred during the download - but no, Loader did not report anything like that. The game was loaded like this:

_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete, false, 0, true); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorLoading, false, 0, true);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onErrorLoading, false, 0, true);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onErrorLoading, false, 0, true);

_loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorLoading, false, 0, true);
_loader.load(new URLRequest(fileLocation));


In the onLoadComplete method, this is what happened:

log.debug("loader info content type:"+_loader.contentLoaderInfo.contentType);
log.debug("loader info URL:"+_loader.contentLoaderInfo.url);
log.debug("loader content:"+_loader.content);

game = _loader.content as MyGameInterface;


The onErrorLoading method was not called, the onLoadComplete worked. I had the following on the machine where everything worked;
10:33:00:453 [DEBUG] loader info content type:application/x-shockwave-flash
10:33:00:453 [DEBUG] loader info URL:file:///C|/Projects/[... ...]/Main.swf
10:33:00:453 [DEBUG] loader content:[object Main]


On the server, the picture was like this:
12:01:03:375 [DEBUG] loader info content type:application/x-shockwave-flash
12:01:03:375 [DEBUG] loader info URL:[... ...]
12:01:03:375 [DEBUG] loader content:instance43942.instance43943


It can be seen that the difference in content: in one case, it turns out some object, and in the other - some unintelligible instances. But what's the matter?

Here I am stuck. He tortured the game developer, forced him to check different compilation modes (with and without network support), checked versions of files, checked security settings — all to no avail.

Finally it dawned on me, and I got into the game code and the bootloader code. It turned out that both there and there programmers called the main class Main and put it in the default package . It is clear that SWF games loaded without problems, but the class could not be loaded from there. I told the developers everything I think, the game developer dragged Main into the right package, and the whole design worked like a clock.

The most curious thing about this is that the flash player did not report this situation. Just silently ignored.

I hope that my report will save someone time to deal with this unusual error.

Source: https://habr.com/ru/post/112614/


All Articles