New problem with xml its filter caused by OpenJDK update

217 views
Skip to first unread message

Marc

unread,
Jun 8, 2022, 4:16:37 PM6/8/22
to okapi-users

Hi all,

one of our integration tests at translate5 did run today in a problem with okapi, that happens when converting an xml file with an xpath in the ITS xml filter.

The following error was thrown by okapi

net.sf.okapi.common.exceptions.OkapiException: javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: JAXP0801002: the compiler encountered an XPath expression containing '101' operators that exceeds the '100' limit set by 'FEATURE_SECURE_PROCESSING'.   

The cause is what is for example documented in the

openjdk-8-release_notes_for_openjdk_8.0.332-en-us.pdf

but seems to be true for updates for other java versions too (we are using OpenJDK 11 on our server, but have the same issue)

CHAPTER 4. KNOWN ISSUES
OpenJDK 8 might include known issues. Solutions might exist for some of these known issues.
XPath expressions
OpenJDK 8 specifies new default limits for XPath expressions. If you find that your code is exceeding
these limits, you can raise them by passing the following parameters to your OpenJDK deployment or by
setting the JAVA_TOOL_OPTIONS environment variable to use them:
-Djdk.xml.xpathExprGrpLimit, which defaults to 10
-Djdk.xml.xpathExprOpLimit, which defaults to 100
-Djdk.xml.xpathTotalOpLimit, which defaults to 10,000
These default limits restrict the number of expression groups, the number of operators in a single
expression, and the total number of operators.

So if you run in this issue: For Rainbow: Change the rainbow.sh as follows:


#!/bin/bash
export SWT_GTK3=0
export LIBOVERLAY_SCROLLBAR=0
java -cp "`dirname $0`/lib/*" -Djdk.xml.xpathExprOpLimit=200 net.sf.okapi.applications.rainbow.Main "$@"

And for Longhorn users with Tomcat: Add a setenv.sh script to the bin directory of your tomcat with the following contents:

JAVA_OPTS="-Djdk.xml.xpathExprOpLimit=200"

This solves the problem.

Perhaps it would be good, if this would be solved in the okapi source code itself somehow, so that not the users have to do the setting?

best

Marc

Reply all
Reply to author
Forward
0 new messages