I have a situation where an Exceptions happens in the Remote service
implementation. I caught that exception and re-throw it to the client
in the hope that the Asynch call would fail and that OnFailure method
of the call back object would execute . But it does not happen instead
the onSucess method executes .
Why ?.
How should I propogate an error from the remore service back to the
UI.
Here is the code
public ArrayList GetQueuesList(){
System.out.println("In Here I am");
try {
System.out.println("In Here I am1");
CacheInterface c = new CacheInterface(url,"Admin","","");
ProDataGraphHolder queuelist = new ProDataGraphHolder();
c.getqueueslist(queuelist);
System.out.println("In Here I am2");
// Marshal the Data out of the DataGraph into a Results List
ProDataGraph queueGraph;
queueGraph = queuelist.getProDataGraphValue();
System.out.println("In Here I am3");
if (queueGraph.getProDataObjects(0) == null) {throw new
Exception("Error Communiucation with Appserver");}
return (ArrayList) queueGraph.getProDataObjects(0);
}
catch(Exception e)
{
System.out.println("Error - " + e.toString());
throw new InvocationException("Error in executing the API");
}
finally {
return null;
}
}
Secondly, you will always return null. the finally block will execute
before the method returns. For example:
public class TestClass {
public static void main(String[] args) {
System.out.println(test());
}
public static String test() {
try {
return "try";
} catch (Exception e) {
return "catch";
} finally {
return "finally";
}
}
}
will always return the string "finally".
On Oct 17, 12:39 pm, "Cherian George(GWT Newbie)"
GWT can transfer any thrown exceptions to the client side, provided
they implement IsSerializable. At least, that's how it worked in GWT
1.3. Now that just 'serializable' is required, I'm no longer sure
about how it works. (Throwable is itself Serializable, but I'm 100%
certain that GWT doesn't take all runtime exceptions in the classpath
and compile them, that would be an enormous waste, yet it would be
required to handle this stuff transparantly). Possibly you need to
explicitly declare them on the 'throws' line.
On Oct 17, 6:39 pm, "Cherian George(GWT Newbie)"