diff options
author | Joe George <joe@zeroc.com> | 2014-12-18 14:37:46 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2014-12-18 14:37:46 -0500 |
commit | e905059ee39cfafd94d8854f10b834fde4fd5856 (patch) | |
tree | d3da8c220be1a8d9cab6541fa0a9b767859f5a7f /android | |
parent | Fixed ICE-6202 - fixed demo/Ice/minimal endpoints (diff) | |
download | ice-e905059ee39cfafd94d8854f10b834fde4fd5856.tar.bz2 ice-e905059ee39cfafd94d8854f10b834fde4fd5856.tar.xz ice-e905059ee39cfafd94d8854f10b834fde4fd5856.zip |
Fix crash if you tried to enter a hostname with a space in HelloWorld
demo
Diffstat (limited to 'android')
-rw-r--r-- | android/demo/hello/src/main/java/com/zeroc/hello/HelloWorld.java | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/android/demo/hello/src/main/java/com/zeroc/hello/HelloWorld.java b/android/demo/hello/src/main/java/com/zeroc/hello/HelloWorld.java index 5db8fed8932..34ea94b9ce1 100644 --- a/android/demo/hello/src/main/java/com/zeroc/hello/HelloWorld.java +++ b/android/demo/hello/src/main/java/com/zeroc/hello/HelloWorld.java @@ -89,7 +89,12 @@ public class HelloWorld extends Activity } String host = _host.getText().toString().trim(); - assert (host.length() > 0); + System.out.println(host.length()); + if(host.length() == 0) + { + _helloPrx = null; + return; + } // Change the preferences if necessary. if(!_prefs.getString(HOSTNAME_KEY, DEFAULT_HOST).equals(host)) { @@ -98,15 +103,23 @@ public class HelloWorld extends Activity edit.commit(); } - String s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000"; - Ice.ObjectPrx prx = _communicator.stringToProxy(s); - prx = _deliveryMode.apply(prx); - int timeout = _timeout.getProgress(); - if(timeout != 0) + try { - prx = prx.ice_timeout(timeout); + String s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000"; + Ice.ObjectPrx prx = _communicator.stringToProxy(s); + prx = _deliveryMode.apply(prx); + int timeout = _timeout.getProgress(); + if(timeout != 0) + { + prx = prx.ice_timeout(timeout); + } + _helloPrx = Demo.HelloPrxHelper.uncheckedCast(prx); + } + catch(Ice.EndpointParseException e) + { + _helloPrx = null; + return; } - _helloPrx = Demo.HelloPrxHelper.uncheckedCast(prx); } class SayHelloI extends Demo.Callback_Hello_sayHello @@ -180,6 +193,10 @@ public class HelloWorld extends Activity private void sayHello() { + if(_helloPrx == null) + { + return; + } try { if(!_deliveryMode.isBatch()) @@ -229,6 +246,10 @@ public class HelloWorld extends Activity private void shutdown() { + if(_helloPrx == null) + { + return; + } try { if(!_deliveryMode.isBatch()) |