diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-09-24 17:07:33 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-09-24 17:07:33 -0400 |
commit | 080656b952732140cae223651714b0a0fc460b08 (patch) | |
tree | fea62f6e795b522ac64230c0a67f7c9cd89544ef /java/src/IceGridGUI/Utils.java | |
parent | Fixed test warning (diff) | |
download | ice-080656b952732140cae223651714b0a0fc460b08.tar.bz2 ice-080656b952732140cae223651714b0a0fc460b08.tar.xz ice-080656b952732140cae223651714b0a0fc460b08.zip |
Squashed commit of the following:
commit 67f0310e1125b278157942d1387f694d9bf9921a
Author: Bernard Normier <bernard@zeroc.com>
Date: Mon Sep 24 16:56:17 2007 -0400
Added ability to retrieve server properties from IceGrid GUI
Diffstat (limited to 'java/src/IceGridGUI/Utils.java')
-rwxr-xr-x | java/src/IceGridGUI/Utils.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/java/src/IceGridGUI/Utils.java b/java/src/IceGridGUI/Utils.java index 4a4310c61f6..a3bffbdc5ec 100755 --- a/java/src/IceGridGUI/Utils.java +++ b/java/src/IceGridGUI/Utils.java @@ -27,6 +27,58 @@ public class Utils } } + // + // Extract Ice version in the form XXYYZZ, e.g. 030201 (for 3.2.1) + // 0 == empty string + // -1 == error + // + static public int getIntVersion(String version) + { + int result = 0; + version = version.trim(); + if(version.length() > 0) + { + try + { + int firstDotPos = version.indexOf('.'); + + if(firstDotPos == -1) + { + result = -1; + } + else + { + result = Integer.parseInt(version.substring(0, firstDotPos)); + if(result == 0) + { + return -1; + } + result *= 100; + + + int secondDotPos = version.indexOf('.', firstDotPos + 1); + if(secondDotPos == -1) + { + result += Integer.parseInt(version.substring(firstDotPos + 1)); + result *= 100; + } + else + { + result += Integer.parseInt(version.substring(firstDotPos + 1, secondDotPos)); + result *= 100; + result += Integer.parseInt(version.substring(secondDotPos + 1)); + } + } + } + catch(NumberFormatException e) + { + result = -1; + } + } + return result; + } + + static public interface Stringifier { public String toString(Object obj); |