Question

We have below overridden functions in java

MailboxUtils.GetMailboxWithUIMap = function(p0, p1, p2, callback) {
    DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, p2, callback);
} 

MailboxUtils.GetMailboxWithUIMap = function(p0, p1, callback) {
    DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, callback);
} 

For some strange reason when tomcat server is started and the program executes, it calls the function with 4 arguments ie function(p0, p1, p2, callback) even though we have passed in only 3 arguments. Then if we restart tomcat server, the system starts behaving normally and starts calling the right function ie function(p0, p1, callback). This seems to be very random and the only way to fix it is to restart Tomcat many times until the problem gets resolved.

Has anyone seen this kind of problem before? ANy way we can fix this?

Was it helpful?

Solution

It turns out that DWR/Javascript does not support function overload

the code itself is written in java which supports function overloads but this code was then being ajaxified using DWR which does not support the overload. So every time the server was restarted , depending on which of the 2 functions was getting loaded last was getting executed.

Had to rename one of the functions so as to stop overload

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top