You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/23 14:48:45 UTC

[commons-jci] branch master updated (7580ee2 -> 0cb56a5)

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

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


    from 7580ee2  Merge pull request #38 from apache/dependabot/github_actions/actions/checkout-3.5.3
     new 5f91430  EclipseJavaCompilerSettings.toNativeVersion(String) now throws IllegalArgumentException instead of RuntimeException
     new 0cb56a5  GrrovyJavaCompiler.compile() now throws IllegalStateException instead of RuntimeException when there is no compiler available

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/jci2/compilers/EclipseJavaCompilerSettings.java    | 10 +++-------
 .../org/apache/commons/jci2/compilers/GroovyJavaCompiler.java  |  2 +-
 src/changes/changes.xml                                        |  7 +++++++
 3 files changed, 11 insertions(+), 8 deletions(-)


[commons-jci] 02/02: GrrovyJavaCompiler.compile() now throws IllegalStateException instead of RuntimeException when there is no compiler available

Posted by gg...@apache.org.
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 0cb56a5f0dac90bb0535debf8279a882af2b0cd2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 10:36:04 2023 -0400

    GrrovyJavaCompiler.compile() now throws IllegalStateException instead of
    RuntimeException when there is no compiler available
---
 .../java/org/apache/commons/jci2/compilers/GroovyJavaCompiler.java     | 2 +-
 src/changes/changes.xml                                                | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/compilers/groovy/src/main/java/org/apache/commons/jci2/compilers/GroovyJavaCompiler.java b/compilers/groovy/src/main/java/org/apache/commons/jci2/compilers/GroovyJavaCompiler.java
index e6d509f..0990538 100644
--- a/compilers/groovy/src/main/java/org/apache/commons/jci2/compilers/GroovyJavaCompiler.java
+++ b/compilers/groovy/src/main/java/org/apache/commons/jci2/compilers/GroovyJavaCompiler.java
@@ -117,7 +117,7 @@ public final class GroovyJavaCompiler extends AbstractJavaCompiler {
                 }
             }
         } catch (final CompilationFailedException e) {
-            throw new RuntimeException("no expected");
+            throw new IllegalArgumentException("no expected");
         }
 
         final CompilationProblem[] result = new CompilationProblem[problems.size()];
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 132c2a6..6563a01 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -69,6 +69,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         EclipseJavaCompilerSettings.toNativeVersion(String) now throws IllegalArgumentException instead of RuntimeException.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+       GroovyJavaCompiler.compile() 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.


[commons-jci] 01/02: EclipseJavaCompilerSettings.toNativeVersion(String) now throws IllegalArgumentException instead of RuntimeException

Posted by gg...@apache.org.
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 <ga...@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.