ICU-0 whitespace cleanup

X-SVN-Rev: 18143
This commit is contained in:
Doug Felt 2005-07-05 21:31:21 +00:00
parent cefffce789
commit 7b07302ec9

View File

@ -270,42 +270,42 @@ public final class VersionInfo
* @deprecated This API is ICU internal only.
*/
public static VersionInfo javaVersion() {
if (javaVersion == null) {
String s = System.getProperty("java.version");
// clean string
// preserve only digits, separated by single '.'
// ignore over 4 digit sequences
// does not test < 255, very odd...
if (javaVersion == null) {
String s = System.getProperty("java.version");
// clean string
// preserve only digits, separated by single '.'
// ignore over 4 digit sequences
// does not test < 255, very odd...
char[] chars = s.toCharArray();
int r = 0, w = 0, count = 0;
boolean numeric = false; // ignore leading non-numerics
while (r < chars.length) {
char c = chars[r++];
if (c < '0' || c > '9') {
if (numeric) {
if (count == 3) {
// only four digit strings allowed
break;
char[] chars = s.toCharArray();
int r = 0, w = 0, count = 0;
boolean numeric = false; // ignore leading non-numerics
while (r < chars.length) {
char c = chars[r++];
if (c < '0' || c > '9') {
if (numeric) {
if (count == 3) {
// only four digit strings allowed
break;
}
numeric = false;
chars[w++] = '.';
++count;
}
} else {
numeric = true;
chars[w++] = c;
}
}
numeric = false;
chars[w++] = '.';
++count;
while (w > 0 && chars[w-1] == '.') {
--w;
}
} else {
numeric = true;
chars[w++] = c;
}
}
while (w > 0 && chars[w-1] == '.') {
--w;
}
String vs = new String(chars, 0, w);
String vs = new String(chars, 0, w);
javaVersion = VersionInfo.getInstance(vs);
}
return javaVersion;
javaVersion = VersionInfo.getInstance(vs);
}
return javaVersion;
}
/**