Skip to content

Commit

Permalink
Fix load on script npe (#5839)
Browse files Browse the repository at this point in the history
* feat: catch internal java exceptions

* fix: fix startup issue with java script enabled on jdk17

---------

Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
yuremm and yurem authored Aug 11, 2023
1 parent 9d90e28 commit ed0be7f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void initJavaCompilerClasspathIfNeeded() {
for (URL url : urls) {
CompilerUtils.addClassPath(url.getFile());
}
} catch (Exception e) {
} catch (Throwable e) {
log.error("FAILED to output class loader urls", e);
}
}
Expand All @@ -76,7 +76,7 @@ public BaseExternalType createExternalType(CustomScript customScript,
} else {
externalType = createExternalTypeFromStringWithPythonException(customScript);
}
} catch (Exception ex) {
} catch (Throwable ex) {
log.error("Failed to prepare external type '{}', exception: '{}'", customScriptInum, ExceptionUtils.getStackTrace(ex));
log.error("Script '{}'", customScript.getScript());
saveScriptError(customScript, ex, true);
Expand Down Expand Up @@ -152,19 +152,19 @@ public BaseExternalType createExternalTypeFromStringWithPythonException(CustomSc
}
}

public void saveScriptError(CustomScript customScript, Exception exception) {
public void saveScriptError(CustomScript customScript, Throwable exception) {
saveScriptError(customScript, exception, false);
}

public void saveScriptError(CustomScript customScript, Exception exception, boolean overwrite) {
public void saveScriptError(CustomScript customScript, Throwable exception, boolean overwrite) {
try {
saveScriptErrorImpl(customScript, exception, overwrite);
} catch (Exception ex) {
log.error("Failed to store script '{}' error", customScript.getInum(), ex);
}
}

protected void saveScriptErrorImpl(CustomScript customScript, Exception exception, boolean overwrite) {
protected void saveScriptErrorImpl(CustomScript customScript, Throwable exception, boolean overwrite) {
// Load entry from DN
String customScriptDn = customScript.getDn();
Class<? extends CustomScript> scriptType = customScript.getScriptType().getCustomScriptModel();
Expand Down

0 comments on commit ed0be7f

Please sign in to comment.