Skip to content

Commit 929aaf3

Browse files
Remove System.getProperty from predicates
1 parent cf1cd7e commit 929aaf3

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package datadog.trace.test.util;
22

3-
import java.math.BigDecimal;
3+
import datadog.environment.JavaVirtualMachine;
44
import java.util.function.Predicate;
55

66
public abstract class Predicates {
@@ -12,21 +12,18 @@ public static class IBM implements Predicate<String> {
1212

1313
@Override
1414
public boolean test(String s) {
15-
return System.getProperty("java.vendor", "").contains(IBM_VENDOR_STRING);
15+
return JavaVirtualMachine.getRuntimeVendor().contains(IBM_VENDOR_STRING);
1616
}
1717
}
1818

1919
public static final class IBM8 extends IBM {
20-
private static final BigDecimal VERSION = new BigDecimal("1.8");
2120

2221
@Override
2322
public boolean test(final String spec) {
2423
if (!super.test(spec)) {
2524
return false;
2625
}
27-
final BigDecimal version =
28-
new BigDecimal(System.getProperty("java.specification.version", "-1"));
29-
return version.equals(VERSION);
26+
return JavaVirtualMachine.isJavaVersion(8);
3027
}
3128
}
3229

@@ -35,21 +32,18 @@ public static class ORACLE implements Predicate<String> {
3532

3633
@Override
3734
public boolean test(String s) {
38-
return System.getProperty("java.vendor", "").contains(ORACLE_VENDOR_STRING);
35+
return JavaVirtualMachine.getRuntimeVendor().contains(ORACLE_VENDOR_STRING);
3936
}
4037
}
4138

4239
public static final class ORACLE8 extends ORACLE {
43-
private static final BigDecimal VERSION = new BigDecimal("1.8");
4440

4541
@Override
4642
public boolean test(final String spec) {
4743
if (!super.test(spec)) {
4844
return false;
4945
}
50-
final BigDecimal version =
51-
new BigDecimal(System.getProperty("java.specification.version", "-1"));
52-
return version.equals(VERSION);
46+
return JavaVirtualMachine.isJavaVersion(8);
5347
}
5448
}
5549
}

0 commit comments

Comments
 (0)