< prev index next >
test/lib/jdk/test/lib/OSVersion.java
Print this page
rev 59189 : imported patch hotspot
@@ -44,13 +44,10 @@
public static final OSVersion WINDOWS_VISTA = new OSVersion(6, 0);
private final int[] versionTokens;
public static OSVersion current() {
- if (Platform.isSolaris()) {
- return new OSVersion(getSolarisVersion());
- }
return new OSVersion(Platform.getOsVersion());
}
public OSVersion(int major, int minor) {
versionTokens = new int[] {major, minor};
@@ -62,30 +59,10 @@
.filter(onlyDigits.asPredicate())
.mapToInt(Integer::parseInt)
.toArray();
}
- private static String getSolarisVersion() {
- try {
- return Utils.distro();
- } catch (Throwable e) {
- System.out.println("First attempt failed with: " + e.getMessage());
- }
-
- // Try to get Solaris version from /etc/release
- try (BufferedReader in = new BufferedReader(AccessController.doPrivileged(
- (PrivilegedExceptionAction<FileReader>) () -> new FileReader("/etc/release")))) {
- return in.readLine().trim().split(" ")[2];
- } catch (PrivilegedActionException e) {
- System.out.println("Second attempt failed with: " + e.getException().getMessage());
- } catch (Exception e) {
- System.out.println("Second attempt failed with: " + e.getMessage());
- }
-
- throw new RuntimeException("Unable to get Solaris version");
- }
-
@Override
public int compareTo(OSVersion o) {
return Arrays.compare(this.versionTokens, o.versionTokens);
}
< prev index next >