Skip to content

Commit

Permalink
ScriptProfile: Fix ISE due to Context is already closed
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 committed Nov 3, 2024
1 parent 9646607 commit 466489d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ public void deactivate() {
return result == null ? null : result.toString();
} catch (ScriptException e) {
throw new TransformationException("Failed to execute script.", e);
} catch (IllegalStateException e) {
String message = e.getMessage();
if (message != null && message.equals("The Context is already closed.")) {
logger.warn(
"Script engine context {} is already closed, this should not happen. Recreating script engine.",
scriptUid);
scriptCache.remove(scriptUid);
return transform(function, source);
} else {
// rethrow
throw e;
}
}
} finally {
scriptRecord.lock.unlock();
Expand Down

0 comments on commit 466489d

Please sign in to comment.