Skip to content

Commit e61abab

Browse files
committed
Fix edge-case NullPointerException in
org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(JavaVersion) Fix edge-case NullPointerException in org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost(JavaVersion)
1 parent 301a626 commit e61abab

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/changes/changes.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ The <action> type attribute can be add,update,fix,remove.
9595
<action type="fix" dev="ggregory" due-to="Ken Dombeck">Fix Javadoc code examples in DiffBuilder and ReflectionDiffBuilder #1400.</action>
9696
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix generics in org.apache.commons.lang3.stream.Streams.toArray(Class) signature.</action>
9797
<action issue="LANG-1727" type="fix" dev="ggregory" due-to="Elliotte Rusty Harold, Gary Gregory">EventListenerSupport doesn't document ordering of events.</action>
98-
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix NullPointerException in org.apache.commons.lang3.SystemUtils.IS_OS_ANDROID.</action>
98+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix edge-case NullPointerException in org.apache.commons.lang3.SystemUtils.IS_OS_ANDROID.</action>
99+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix edge-case NullPointerException in org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(JavaVersion).</action>
100+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Fix edge-case NullPointerException in org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost(JavaVersion).</action>
99101
<!-- ADD -->
100102
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Strings and refactor StringUtils.</action>
101103
<action issue="LANG-1747" type="add" dev="ggregory" due-to="Oliver B. Fischer, Gary Gregory">Add StopWatch.run([Failable]Runnable) and get([Failable]Supplier).</action>

src/main/java/org/apache/commons/lang3/SystemUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ public static boolean isJavaAwtHeadless() {
22812281
* @return {@code true} if the actual version is equal or greater than the required version
22822282
*/
22832283
public static boolean isJavaVersionAtLeast(final JavaVersion requiredVersion) {
2284-
return JAVA_SPECIFICATION_VERSION_AS_ENUM.atLeast(requiredVersion);
2284+
return JAVA_SPECIFICATION_VERSION_AS_ENUM != null && JAVA_SPECIFICATION_VERSION_AS_ENUM.atLeast(requiredVersion);
22852285
}
22862286

22872287
/**
@@ -2295,7 +2295,7 @@ public static boolean isJavaVersionAtLeast(final JavaVersion requiredVersion) {
22952295
* @since 3.9
22962296
*/
22972297
public static boolean isJavaVersionAtMost(final JavaVersion requiredVersion) {
2298-
return JAVA_SPECIFICATION_VERSION_AS_ENUM.atMost(requiredVersion);
2298+
return JAVA_SPECIFICATION_VERSION_AS_ENUM != null && JAVA_SPECIFICATION_VERSION_AS_ENUM.atMost(requiredVersion);
22992299
}
23002300

23012301
/**

0 commit comments

Comments
 (0)