From 6bda5d7e4e80d1aefb4f19203361b7199448e70f Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 5 Mar 2020 10:50:48 +0000 Subject: Use Rhino javascript executor in apex-pdp Integation unit tests resultd in StackOverflowException errors in the Graal Javascript interpreter. Following extensive testing and trouobleshooting, it proved very difficult to fix these issues in Graal as the stck overflow errors were occurring in native class instantiation methods being invoked by Grall on the JVM. The alternative Rhino Javascript engine is developed by mozilla, and was incorporated into the Java 6 JVM and evolved into Nashorn in the Java 8 JVM. Oracle dropped Nashorn in Java 11. However, in parallel, Rhino development has continued. This review brings in the Rhino javascript engine into apex-pdp as the replacement for Nashorn and instead of Graal. Graal seems to be pretty unstable as yet so we may bring it in in future releases but for now Rhino is a more stable and reliable alternative. Issue-ID: POLICY-2106 Change-Id: I0edeff3b0bee404b38e3ebe22001a6e3375a44dc Signed-off-by: liamfallon --- .../onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'context') diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java index e4cdd0fdc..96944684e 100644 --- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java +++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java @@ -35,7 +35,6 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.SchemaParameters; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema; -import org.onap.policy.apex.model.utilities.typeutils.TypeBuilder; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -79,8 +78,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper { // For Java, the schema is the Java class canonical path try { - setSchemaClass(TypeBuilder.getJavaTypeClass(schema.getSchema())); - } catch (final IllegalArgumentException e) { + setSchemaClass(Class.forName(schema.getSchema())); + } catch (final Exception e) { String resultSting = userKey.getId() + ": class/type " + schema.getSchema() + " for context schema \"" + schema.getId() + "\" not found."; -- cgit 1.2.3-korg