SCXML-239: Groovy Context lose sync after serialize/deserialize of SCinstance
- see: https://issues.apache.org/jira/browse/SCXML-239 for details
- 'quick and dirty' fix: only use 'plain' SimpleContext for protected SCXMLSystemContext internal Context and (by default) for root Context
  This prevents custom variable (de)serialization logic as implemented in GroovyContext which causes 'disconnected' duplicate deserialization of the SCInstance Status object
- SCXML-247 will provide a more proper solution.
diff --git a/src/main/java/org/apache/commons/scxml2/SCInstance.java b/src/main/java/org/apache/commons/scxml2/SCInstance.java
index 73051ab..51fbbf5 100644
--- a/src/main/java/org/apache/commons/scxml2/SCInstance.java
+++ b/src/main/java/org/apache/commons/scxml2/SCInstance.java
@@ -363,9 +363,8 @@
      * @return The root context.
      */
     public Context getRootContext() {
-        if (rootContext == null && evaluator != null) {
-            rootContext = Evaluator.NULL_DATA_MODEL.equals(evaluator.getSupportedDatamodel())
-                    ? new SimpleContext() : evaluator.newContext(null);
+        if (rootContext == null) {
+            rootContext = new SimpleContext();
         }
         return rootContext;
     }
@@ -380,7 +379,7 @@
         getRootContext();
         if (systemContext != null) {
             // re-parent the system context
-            systemContext.setSystemContext(evaluator.newContext(rootContext));
+            systemContext.setSystemContext(new SimpleContext(rootContext));
         }
     }
 
@@ -394,8 +393,7 @@
             // force initialization of rootContext
             getRootContext();
             if (rootContext != null) {
-                Context internalContext = Evaluator.NULL_DATA_MODEL.equals(evaluator.getSupportedDatamodel()) ?
-                        new SimpleContext() : evaluator.newContext(rootContext);
+                Context internalContext = new SimpleContext(rootContext);
                 systemContext = new SCXMLSystemContext(internalContext);
                 systemContext.getContext().set(SCXMLSystemContext.SESSIONID_KEY, UUID.randomUUID().toString());
                 String _name = stateMachine != null && stateMachine.getName() != null ? stateMachine.getName() : "";
diff --git a/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java b/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java
index b9a8ab6..cb02475 100644
--- a/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java
+++ b/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java
@@ -41,11 +41,6 @@
     }
     
     @Test
-    public void testGetRootContextNull() {
-        Assert.assertNull(instance.getRootContext());
-    }
-    
-    @Test
     public void testGetRootContext() {
         Context context = new SimpleContext();
         context.set("name", "value");
@@ -55,15 +50,6 @@
     }
     
     @Test
-    public void testGetRootContextEvaluator() throws Exception {
-        Evaluator evaluator = new JexlEvaluator();
-
-        executor.setEvaluator(evaluator);
-
-        Assert.assertTrue(instance.getRootContext() instanceof JexlContext);
-    }
-    
-    @Test
     public void testGetContext() {
         State target = new State();
         target.setId("1");