CenturyLinkCloud / mdw

https://centurylinkcloud.github.io/mdw/
MIT License
46 stars 10 forks source link

Unparseable adapter response content can prevent activity retry #784

Closed donaldoakes closed 4 years ago

donaldoakes commented 4 years ago

If an adapter is configured with a response variable of type JSONObject or Jsonable, and yet the response data is XML or otherwise invalid JSON, then on retry populating the runtimeContext causes an exception that prevents the activity from executing (see below). Unparseable content should log an error but not prevent the activity from executing. Also no need to populate the runtimeContext if there are no registered AdapterMonitors.

Workaround: Click on the Values nav link, then the Edit button and temporarily set the response variable value to any valid JSON (say {}). Then the runtimeContext can be correctly built to allow the next retry to succeed

com.centurylink.mdw.activity.ActivityException: Error retrieving DOCUMENT:156190842
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
org.json.JSONTokener.syntaxError(JSONTokener.java:505)
org.json.JSONObject.<init>(JSONObject.java:214)
org.json.JSONObject.<init>(JSONObject.java:357)
io.limberest.json.JsonObject.<init>(JsonObject.java:25)
com.centurylink.mdw.model.JsonObject.<init>(JsonObject.java:35)
com.centurylink.mdw.common.translator.impl.JsonObjectTranslator.realToObject(JsonObjectTranslator.java:30)
com.centurylink.mdw.translator.VariableTranslator.realToObject(VariableTranslator.java:172)
com.centurylink.mdw.model.variable.Document.getObject(Document.java:41)
com.centurylink.mdw.services.process.BaseActivity.getDocument(BaseActivity.java:869)
com.centurylink.mdw.services.process.BaseActivity.getVariableValue(BaseActivity.java:1238)
com.centurylink.mdw.services.process.BaseActivity.getRuntimeContext(BaseActivity.java:101)
com.centurylink.mdw.workflow.adapter.TextAdapterActivity.doInvoke(TextAdapterActivity.java:789)
com.centurylink.mdw.workflow.adapter.TextAdapterActivity.execute(TextAdapterActivity.java:376)
com.centurylink.mdw.workflow.activity.DefaultActivityImpl.execute(DefaultActivityImpl.java:40)
com.centurylink.mdw.services.process.BaseActivity.execute(BaseActivity.java:211)
com.centurylink.mdw.services.process.BaseActivity.executeTimed(BaseActivity.java:227)
com.centurylink.mdw.services.process.ProcessEngineDriver.executeActivity(ProcessEngineDriver.java:380)
com.centurylink.mdw.services.process.ProcessEngineDriver.processEvent(ProcessEngineDriver.java:631)
com.centurylink.mdw.services.process.ProcessEngineDriver.processEvents(ProcessEngineDriver.java:589)
com.centurylink.mdw.services.process.InternalEventDriver.run(InternalEventDriver.java:37)
com.centurylink.mdw.container.plugin.CommonThreadPool$Work.run(CommonThreadPool.java:263)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
com.centurylink.mdw.container.plugin.CommonThreadPool$ManagedThread.run(CommonThreadPool.java:232)