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-scxml.git


The following commit(s) were added to refs/heads/master by this push:
     new ad4fcfc  Update call deprecated in Java 9
ad4fcfc is described below

commit ad4fcfc721e537926898bfa48ca4e1825952ce29
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Oct 2 15:18:30 2023 -0400

    Update call deprecated in Java 9
---
 src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java    | 4 ++--
 .../apache/commons/scxml2/env/groovy/GroovyExtendableScriptCache.java | 2 +-
 src/main/java/org/apache/commons/scxml2/invoke/Invoker.java           | 2 +-
 src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java           | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java 
b/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
index 7af2fcb..72917c0 100644
--- a/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
+++ b/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
@@ -448,8 +448,8 @@ public class SCXMLExecutionContext implements 
SCXMLIOProcessor {
             throw new InvokerException("No Invoker registered for type \"" + 
stripTrailingSlash(type) + "\"");
         }
         try {
-            return invokerClass.newInstance();
-        } catch (InstantiationException | IllegalAccessException ie) {
+            return invokerClass.getConstructor().newInstance();
+        } catch (ReflectiveOperationException ie) {
             throw new InvokerException(ie.getMessage(), ie.getCause());
         }
     }
diff --git 
a/src/main/java/org/apache/commons/scxml2/env/groovy/GroovyExtendableScriptCache.java
 
b/src/main/java/org/apache/commons/scxml2/env/groovy/GroovyExtendableScriptCache.java
index 36ccc17..3b5d983 100644
--- 
a/src/main/java/org/apache/commons/scxml2/env/groovy/GroovyExtendableScriptCache.java
+++ 
b/src/main/java/org/apache/commons/scxml2/env/groovy/GroovyExtendableScriptCache.java
@@ -220,7 +220,7 @@ public class GroovyExtendableScriptCache implements 
Serializable {
             }
         }
         try {
-            return scriptClass.newInstance();
+            return scriptClass.getConstructor().newInstance();
         } catch (final Exception e) {
             throw new GroovyRuntimeException("Failed to create Script instance 
for class: "+ scriptClass + ". Reason: " + e, e);
         }
diff --git a/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java 
b/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
index 9e996bc..7e89a6e 100644
--- a/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
+++ b/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
@@ -48,7 +48,7 @@ import org.apache.commons.scxml2.TriggerEvent;
  *
  * <p>The Invoker "lifecycle" is outlined below:</p>
  * <ol>
- *  <li>Instantiation via {@link Class#newInstance()}
+ *  <li>Instantiation via {@code clazz.getConstructor().newInstance()}
  *      (Invoker implementation requires accessible constructor).</li>
  *  <li>Configuration (setters for invoke ID and
  *      {@link org.apache.commons.scxml2.SCXMLExecutor}).</li>
diff --git a/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java 
b/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
index 19432e8..8dd1cc7 100644
--- a/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
+++ b/src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java
@@ -1988,12 +1988,12 @@ public final class SCXMLReader {
         Class<?> clazz;
         try {
             clazz = cl.loadClass(className);
-            actionObject = clazz.newInstance();
+            actionObject = clazz.getConstructor().newInstance();
         } catch (final ClassNotFoundException cnfe) {
             throw new XMLStreamException("Cannot find custom action class:" + 
className, cnfe);
         } catch (final IllegalAccessException iae) {
             throw new XMLStreamException("Cannot access custom action class:" 
+ className, iae);
-        } catch (final InstantiationException ie) {
+        } catch (final ReflectiveOperationException ie) {
             throw new XMLStreamException("Cannot instantiate custom action 
class:" + className, ie);
         }
         if (!(actionObject instanceof Action)) {

Reply via email to