diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /java/test/Ice/exceptions | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'java/test/Ice/exceptions')
-rw-r--r-- | java/test/Ice/exceptions/AllTests.java | 2090 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Client.java | 10 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Server.java | 12 |
3 files changed, 1056 insertions, 1056 deletions
diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java index b463836d80a..60a2e2a8652 100644 --- a/java/test/Ice/exceptions/AllTests.java +++ b/java/test/Ice/exceptions/AllTests.java @@ -22,801 +22,801 @@ public class AllTests private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMI_Thrower_throwAasAI extends AMI_Thrower_throwAasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(A ex) + { + test(ex.aMem == 1); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAasAObjectNotExistI extends AMI_Thrower_throwAasA { AMI_Thrower_throwAasAObjectNotExistI(Ice.Communicator communicator) - { - _communicator = communicator; - } - - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ObjectNotExistException ex) - { - Ice.Identity id = _communicator.stringToIdentity("does not exist"); - test(ex.id.equals(id)); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - private Ice.Communicator _communicator; + { + _communicator = communicator; + } + + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.ObjectNotExistException ex) + { + Ice.Identity id = _communicator.stringToIdentity("does not exist"); + test(ex.id.equals(id)); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public void + ice_exception(Ice.UserException exc) + { + exc.printStackTrace(); + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + private Ice.Communicator _communicator; } private static class AMI_Thrower_throwAasAFacetNotExistI extends AMI_Thrower_throwAasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.FacetNotExistException ex) + { + test(ex.facet.equals("no such facet")); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public void + ice_exception(Ice.UserException exc) + { + exc.printStackTrace(); + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAorDasAorDI extends AMI_Thrower_throwAorDasAorD { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(D ex) - { - test(ex.dMem == -1); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(A ex) + { + test(ex.aMem == 1); + } + catch(D ex) + { + test(ex.dMem == -1); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwBasAI extends AMI_Thrower_throwBasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(B ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasAI extends AMI_Thrower_throwCasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwBasBI extends AMI_Thrower_throwBasB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(B ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasBI extends AMI_Thrower_throwCasB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasCI extends AMI_Thrower_throwCasC { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredAI extends AMI_Thrower_throwUndeclaredA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredBI extends AMI_Thrower_throwUndeclaredB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredCI extends AMI_Thrower_throwUndeclaredC { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwLocalExceptionI extends AMI_Thrower_throwLocalException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownLocalException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwNonIceExceptionI extends AMI_Thrower_throwNonIceException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAssertExceptionI extends AMI_Thrower_throwAssertException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.ConnectionLostException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_WrongOperation_noSuchOperationI extends AMI_WrongOperation_noSuchOperation { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.OperationNotExistException ex) - { - test(ex.operation.equals("noSuchOperation")); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.OperationNotExistException ex) + { + test(ex.operation.equals("noSuchOperation")); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } public static ThrowerPrx allTests(Ice.Communicator communicator, boolean collocated) { - { - System.out.print("testing object adapter registration exceptions... "); - Ice.ObjectAdapter first; - try - { - first = communicator.createObjectAdapter("TestAdapter0"); - } - catch(Ice.InitializationException ex) - { - // Expected - } - - communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); - first = communicator.createObjectAdapter("TestAdapter0"); - try - { - Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - - try - { - Ice.ObjectAdapter second = - communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").equals("default")); - first.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing servant registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); - Ice.Object obj = new EmptyI(); - adapter.add(obj, communicator.stringToIdentity("x")); - try - { - adapter.add(obj, communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - - adapter.remove(communicator.stringToIdentity("x")); - try - { - adapter.remove(communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - } - adapter.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing servant locator registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); - Ice.ServantLocator loc = new ServantLocatorI(); - adapter.addServantLocator(loc, "x"); - try - { - adapter.addServantLocator(loc, "x"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - - adapter.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing object factory registration exception... "); - Ice.ObjectFactory of = new ObjectFactoryI(); - communicator.addObjectFactory(of, "::x"); - try - { - communicator.addObjectFactory(of, "::x"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - System.out.println("ok"); - } + { + System.out.print("testing object adapter registration exceptions... "); + Ice.ObjectAdapter first; + try + { + first = communicator.createObjectAdapter("TestAdapter0"); + } + catch(Ice.InitializationException ex) + { + // Expected + } + + communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); + first = communicator.createObjectAdapter("TestAdapter0"); + try + { + Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + // Expected + } + + try + { + Ice.ObjectAdapter second = + communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + // Expected + } + test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").equals("default")); + first.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing servant registration exceptions... "); + communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); + Ice.Object obj = new EmptyI(); + adapter.add(obj, communicator.stringToIdentity("x")); + try + { + adapter.add(obj, communicator.stringToIdentity("x")); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + + adapter.remove(communicator.stringToIdentity("x")); + try + { + adapter.remove(communicator.stringToIdentity("x")); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + } + adapter.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing servant locator registration exceptions... "); + communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); + Ice.ServantLocator loc = new ServantLocatorI(); + adapter.addServantLocator(loc, "x"); + try + { + adapter.addServantLocator(loc, "x"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + + adapter.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing object factory registration exception... "); + Ice.ObjectFactory of = new ObjectFactoryI(); + communicator.addObjectFactory(of, "::x"); + try + { + communicator.addObjectFactory(of, "::x"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + System.out.println("ok"); + } System.out.print("testing stringToProxy... "); System.out.flush(); @@ -846,7 +846,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -861,7 +861,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -876,7 +876,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -892,7 +892,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -909,7 +909,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -929,7 +929,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -945,14 +945,14 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } System.out.println("ok"); - System.out.print("catching derived types... "); - System.out.flush(); + System.out.print("catching derived types... "); + System.out.flush(); try { @@ -966,7 +966,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -983,7 +983,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1000,134 +1000,134 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } System.out.println("ok"); - if(thrower.supportsUndeclaredExceptions()) - { - test(!collocated); - - System.out.print("catching unknown user exception... "); - System.out.flush(); - - try - { - thrower.throwUndeclaredA(1); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredB(1, 2); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredC(1, 2, 3); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - System.out.print("testing assert in the server... "); - System.out.flush(); - - try - { - thrower.throwAssertException(); - test(false); - } - catch(java.lang.AssertionError ex) - { - assert(collocated); - } - catch(Ice.ConnectionLostException ex) - { - assert(!collocated); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - } - - System.out.print("catching object not exist exception... "); - System.out.flush(); - - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); - thrower2.ice_ping(); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - test(ex.id.equals(id)); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - } + if(thrower.supportsUndeclaredExceptions()) + { + test(!collocated); + + System.out.print("catching unknown user exception... "); + System.out.flush(); + + try + { + thrower.throwUndeclaredA(1); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + try + { + thrower.throwUndeclaredB(1, 2); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + try + { + thrower.throwUndeclaredC(1, 2, 3); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + } + + if(thrower.supportsAssertException()) + { + System.out.print("testing assert in the server... "); + System.out.flush(); + + try + { + thrower.throwAssertException(); + test(false); + } + catch(java.lang.AssertionError ex) + { + assert(collocated); + } + catch(Ice.ConnectionLostException ex) + { + assert(!collocated); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + } + + System.out.print("catching object not exist exception... "); + System.out.flush(); + + { + Ice.Identity id = communicator.stringToIdentity("does not exist"); + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); + thrower2.ice_ping(); + test(false); + } + catch(Ice.ObjectNotExistException ex) + { + test(ex.id.equals(id)); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + } System.out.println("ok"); System.out.print("catching facet not exist exception... "); System.out.flush(); - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - try - { - thrower2.ice_ping(); - test(false); - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - } + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); + try + { + thrower2.ice_ping(); + test(false); + } + catch(Ice.FacetNotExistException ex) + { + test(ex.facet.equals("no such facet")); + } + } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1138,17 +1138,17 @@ public class AllTests try { - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation(); - test(false); + WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); + thrower2.noSuchOperation(); + test(false); } catch(Ice.OperationNotExistException ex) { - test(ex.operation.equals("noSuchOperation")); + test(ex.operation.equals("noSuchOperation")); } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1164,23 +1164,23 @@ public class AllTests } catch(Ice.TimeoutException ex) { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); - } + // + // We get the original exception with collocation + // optimization. + // + test(collocated); + } catch(Ice.UnknownLocalException ex) { - // - // We get an unknown local exception without collocation - // optimization. - // - test(!collocated); - } + // + // We get an unknown local exception without collocation + // optimization. + // + test(!collocated); + } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1196,192 +1196,192 @@ public class AllTests } catch(Ice.UnknownException ex) { - // - // We get the an unknown exception without collocation - // optimization. - // - test(!collocated); + // + // We get the an unknown exception without collocation + // optimization. + // + test(!collocated); } catch(RuntimeException ex) { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); + // + // We get the original exception with collocation + // optimization. + // + test(collocated); } System.out.println("ok"); - if(!collocated) - { - System.out.print("catching exact types with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); - thrower.throwAasA_async(cb, 1); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwAasA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, -1); - test(cb.check()); - } - - { - AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI(); - thrower.throwBasB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI(); - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - + if(!collocated) + { + System.out.print("catching exact types with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); + thrower.throwAasA_async(cb, 1); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + thrower.throwAasA_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); + thrower.throwAorDasAorD_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); + thrower.throwAorDasAorD_async(cb, -1); + test(cb.check()); + } + + { + AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI(); + thrower.throwBasB_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI(); + thrower.throwCasC_async(cb, 1, 2, 3); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + thrower.throwCasC_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + System.out.print("catching derived types with AMI... "); System.out.flush(); - - { - AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); - thrower.throwBasA_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI(); - thrower.throwCasA_async(cb, 1, 2, 3); - test(cb.check()); - } - - { - AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI(); - thrower.throwCasB_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - - if(thrower.supportsUndeclaredExceptions()) - { - System.out.print("catching unknown user exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); - thrower.throwUndeclaredA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI(); - thrower.throwUndeclaredB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI(); - thrower.throwUndeclaredC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - System.out.print("testing assert in the server with AMI... "); - System.out.flush(); - - AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); - thrower.throwAssertException_async(cb); - test(cb.check()); - - System.out.println("ok"); - } - - System.out.print("catching object not exist exception with AMI... "); - System.out.flush(); - - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); - AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching facet not exist exception with AMI... "); - System.out.flush(); - - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - { - AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI(); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - - System.out.print("catching operation not exist exception with AMI... "); - System.out.flush(); - - { - AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation_async(cb); - test(cb.check()); - } - - System.out.println("ok"); + + { + AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); + thrower.throwBasA_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI(); + thrower.throwCasA_async(cb, 1, 2, 3); + test(cb.check()); + } + + { + AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI(); + thrower.throwCasB_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + + if(thrower.supportsUndeclaredExceptions()) + { + System.out.print("catching unknown user exception with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); + thrower.throwUndeclaredA_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI(); + thrower.throwUndeclaredB_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI(); + thrower.throwUndeclaredC_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + } + + if(thrower.supportsAssertException()) + { + System.out.print("testing assert in the server with AMI... "); + System.out.flush(); + + AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); + thrower.throwAssertException_async(cb); + test(cb.check()); + + System.out.println("ok"); + } + + System.out.print("catching object not exist exception with AMI... "); + System.out.flush(); + + { + Ice.Identity id = communicator.stringToIdentity("does not exist"); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); + AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator); + thrower2.throwAasA_async(cb, 1); + test(cb.check()); + } + + System.out.println("ok"); + + System.out.print("catching facet not exist exception with AMI... "); + System.out.flush(); + + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); + { + AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI(); + thrower2.throwAasA_async(cb, 1); + test(cb.check()); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + + System.out.print("catching operation not exist exception with AMI... "); + System.out.flush(); + + { + AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); + WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); + thrower2.noSuchOperation_async(cb); + test(cb.check()); + } + + System.out.println("ok"); - System.out.print("catching unknown local exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); - thrower.throwLocalException_async(cb); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching unknown non-Ice exception with AMI... "); - System.out.flush(); - - AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); - thrower.throwNonIceException_async(cb); - test(cb.check()); - - System.out.println("ok"); - } + System.out.print("catching unknown local exception with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); + thrower.throwLocalException_async(cb); + test(cb.check()); + } + + System.out.println("ok"); + + System.out.print("catching unknown non-Ice exception with AMI... "); + System.out.flush(); + + AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); + thrower.throwNonIceException_async(cb); + test(cb.check()); + + System.out.println("ok"); + } return thrower; } diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java index 323b6652c40..8f97b2e19c1 100644 --- a/java/test/Ice/exceptions/Client.java +++ b/java/test/Ice/exceptions/Client.java @@ -27,10 +27,10 @@ public class Client try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Warn.Connections", "0"); + Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Warn.Connections", "0"); communicator = Ice.Util.initialize(argsH, initData); status = run(args, communicator); @@ -54,7 +54,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/exceptions/Server.java b/java/test/Ice/exceptions/Server.java index 9035ff41b9f..4c97c5e6582 100644 --- a/java/test/Ice/exceptions/Server.java +++ b/java/test/Ice/exceptions/Server.java @@ -13,7 +13,7 @@ public class Server run(String[] args, Ice.Communicator communicator) { Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings, because we have a dummy logger. + // We don't need to disable warnings, because we have a dummy logger. //properties.setProperty("Ice.Warn.Dispatch", "0"); properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); @@ -32,12 +32,12 @@ public class Server try { - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // + // + // For this test, we need a dummy logger, otherwise the + // assertion test will print an error message. + // Ice.InitializationData initData = new Ice.InitializationData(); - initData.logger = new DummyLogger(); + initData.logger = new DummyLogger(); communicator = Ice.Util.initialize(args, initData); status = run(args, communicator); |