This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jci.git

commit 5f9143011b87bcc869952a4dac216e63b10fc1ab
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Jun 23 10:28:48 2023 -0400

    EclipseJavaCompilerSettings.toNativeVersion(String) now throws
    IllegalArgumentException instead of RuntimeException
---
 .../commons/jci2/compilers/EclipseJavaCompilerSettings.java    | 10 +++-------
 src/changes/changes.xml                                        |  4 ++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/compilers/eclipse/src/main/java/org/apache/commons/jci2/compilers/EclipseJavaCompilerSettings.java
 
b/compilers/eclipse/src/main/java/org/apache/commons/jci2/compilers/EclipseJavaCompilerSettings.java
index 56d3435..e53cd3a 100644
--- 
a/compilers/eclipse/src/main/java/org/apache/commons/jci2/compilers/EclipseJavaCompilerSettings.java
+++ 
b/compilers/eclipse/src/main/java/org/apache/commons/jci2/compilers/EclipseJavaCompilerSettings.java
@@ -63,13 +63,9 @@ public final class EclipseJavaCompilerSettings extends 
JavaCompilerSettings {
     }};
 
     private String toNativeVersion( final String pVersion ) {
-       final String nativeVersion = nativeVersions.get(pVersion);
-
-       if (nativeVersion == null) {
-               throw new RuntimeException("unknown version " + pVersion);
-       }
-
-       return nativeVersion;
+        return nativeVersions.computeIfAbsent(pVersion, k -> {
+            throw new IllegalArgumentException("unknown version " + pVersion);
+        });
     }
 
     Map<String, String> toNativeSettings() {
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 38a8cda..132c2a6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,10 @@ The <action> type attribute can be add,update,fix,remove.
 
   <body>
     <release version="2.0" date="202Y-MM-DD" description="Major release (Java 
8).">
+      <!--  FIX -->
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        EclipseJavaCompilerSettings.toNativeVersion(String) now throws 
IllegalArgumentException instead of RuntimeException.
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">
         Bump commons-io from 2.2 to 2.13.0 #11.

Reply via email to