This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-68c0c6fd-e9cd-4998-97d5-d02fc58a9442 XWIKI-25579 Open

Report a missing or invalid jar in the errors of the script macros

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f7a12193-f9df-497b-8497-65a099ecb9c5 Charpentier Lucas created this issue on 23/Oct/26 17:13
 
Summary: Report a missing or invalid jar in the errors of the script macros
Issue Type: cid:jira-generated-image-avatar-68c0c6fd-e9cd-4998-97d5-d02fc58a9442 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Groovy, Rendering - Script Macro, Rendering - Velocity Macro
Created: 23/Oct/26 17:13
Priority: cid:jira-generated-image-static-major-78e81a0d-31bb-424a-8411-082626555696 Major
Reporter: Charpentier Lucas
Description:

The jars parameter of the script macros adds JAR files to the class path of the script, from attachments or URLs. When a JAR cannot be found or read, the macros give a message that names neither the attachment nor the parameter, and sometimes blames something else.

The macros to change, with the file where most of the fix is done:

The main problems:

  • A missing attachment, like attach:nosuch.jar, gives "inputStream" for groovy, and "Can't find script engine with name [python]" for python and script, which blames the engine instead of the attachment. velocity ignores it silently.
  • A value that is not a URL, or a list with a space after the comma, gives "Failed to add JAR URLs to the current class loader for [...]", a technical message with no hint of the expected format.

The fix is to check each JAR before adding it to the class loader and, when one cannot be read, to fail with an error that names the jars parameter and the JAR. The format of the list, its separator included, is declared by XWIKI-25509.

Depends on

  • XCOMMONS-3847, which refuses the boolean and number values that do not convert.
  • XRENDERING-823, which makes the error of an invalid parameter name the parameter and the expected value.
  • XWIKI-25509, which declares the format of the jars list.

KOs covered

Macro Criterion Problem
groovy E2 errors A missing attachment gives the message "inputStream", which names neither the attachment nor the parameter, and a value that is not a URL, or a list with a space, gives "Failed to add JAR URLs to the current class loader for [...]". Partly covered, see below.
python E2 errors A missing attachment, or two references without a separator, gives "Can't find script engine with name [python]", which blames the engine, and a value that is not a JAR but looks like a URL is accepted with no message. Partly covered, see below.
script E2 errors A missing attachment, or a list with a space, gives "Can't find script engine with name [...]" about the python engine instead of the attachment, and a value that is not a URL gives "Failed to add JAR URLs to the current class loader". Partly covered, see below.
velocity E2 errors jars="attach:nosuch.jar" renders as if the parameter was not set, and a value that is not a URL gives "Failed to add JAR URLs to the current class loader for [notaurl]", a technical message. Partly covered, see below.

Impact found on macro fluidity

These 4 KOs come from the WYSIWYG usability audit of the macros, under the criterion E2 errors of its usability criteria, which asks that an invalid parameter value produces a message that says what is wrong and how to fix it, not a stack trace. The page of each macro, linked in the table, has the full notes and the steps to reproduce.

Each of these KOs is only partly covered here, for the problems specific to the macro. The same KOs also report invalid values that the macro system handles for every macro: XCOMMONS-3847 refuses the booleans and numbers that do not convert, and XRENDERING-823 makes the error name the parameter and the expected value. The language of script and the filter of velocity are covered by XWIKI-25500.