diff options
author | Mark Spruiell <mes@zeroc.com> | 2010-01-05 20:17:33 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2010-01-05 20:17:33 -0800 |
commit | cf24e681e8c52cd20d81fe750ff258e67ee65734 (patch) | |
tree | 8411820ce3a257272d6ffa0d3dcdab9ce106609a /java/demo/book/printer/Client.java | |
parent | Fixed bug 4576 - add NPTL options only on Rhel4 (diff) | |
download | ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.tar.bz2 ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.tar.xz ice-cf24e681e8c52cd20d81fe750ff258e67ee65734.zip |
bug 4495 - clean up book demos
Diffstat (limited to 'java/demo/book/printer/Client.java')
-rw-r--r-- | java/demo/book/printer/Client.java | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/java/demo/book/printer/Client.java b/java/demo/book/printer/Client.java index bb18ab4bc71..8f2fe114658 100644 --- a/java/demo/book/printer/Client.java +++ b/java/demo/book/printer/Client.java @@ -7,34 +7,43 @@ // // ********************************************************************** -public class Client { +public class Client +{ public static void main(String[] args) { int status = 0; Ice.Communicator ic = null; - try { + try + { ic = Ice.Util.initialize(args); - Ice.ObjectPrx base = ic.stringToProxy( - "SimplePrinter:default -p 10000"); + Ice.ObjectPrx base = ic.stringToProxy("SimplePrinter:default -p 10000"); Demo.PrinterPrx printer = Demo.PrinterPrxHelper.checkedCast(base); - if (printer == null) + if(printer == null) + { throw new Error("Invalid proxy"); + } printer.printString("Hello World!"); - } catch (Ice.LocalException e) { + } + catch(Ice.LocalException e) + { e.printStackTrace(); status = 1; - } catch (Exception e) { + } + catch(Exception e) + { System.err.println(e.getMessage()); status = 1; } - if (ic != null) { - // Clean up - // - try { + if(ic != null) + { + try + { ic.destroy(); - } catch (Exception e) { + } + catch(Exception e) + { System.err.println(e.getMessage()); status = 1; } |