From 017caac70b4b0fd0cb60f130f10fa564e343f98b Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 23 Jun 2005 21:39:21 +0000 Subject: [PATCH] Added detection of OS version to RunAnywhere git-svn-id: https://samskivert.googlecode.com/svn/trunk@1661 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/KeyUtil.java | 8 ++++++++ .../src/java/com/samskivert/util/RunAnywhere.java | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/util/KeyUtil.java b/projects/samskivert/src/java/com/samskivert/util/KeyUtil.java index 29e5339b..31001b2c 100644 --- a/projects/samskivert/src/java/com/samskivert/util/KeyUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/KeyUtil.java @@ -79,6 +79,14 @@ public class KeyUtil return (rem == 0 ? prekey : key + (10 - rem)); } + public static void main (String[] args) { + + String base = "888888888888888888"; + for (int ii = 0; ii < 10; ii++) { + System.out.println(makeLuhnVerifiable(base + ii)); + } + } + /** * Return the luhn remainder for the given key. * diff --git a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java index 53323a8f..fb0e43e2 100644 --- a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java +++ b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java @@ -40,6 +40,14 @@ public class RunAnywhere { return _isLinux; } + + /** + * Returns the string value of the OS version reported by the JVM + */ + public static final String getOSVersion () + { + return _osversion; + } /** * Returns {@link System#currentTimeMillis}, but works around a bug on @@ -91,6 +99,9 @@ public class RunAnywhere /** Flag indicating that we're on Linux; initialized when this class * is first loaded. */ protected static boolean _isLinux; + + /** The version number that our OS reports */ + protected static String _osversion; /** Used to ensure that the timer is sane. */ protected static long _lastStamp, _lastWarning; @@ -103,6 +114,8 @@ public class RunAnywhere _isMacOS = (osname.indexOf("Mac OS") != -1 || osname.indexOf("MacOS") != -1); _isLinux = (osname.indexOf("Linux") != -1); + + _osversion = System.getProperty("os.version"); } catch (Exception e) { // dang, can't grab system properties; we'll just pretend // we're not on any of these OSes