FEATURE_SECURE_PROCESSING error when open project

Issue #48 resolved
Hiroshi Miura(Tokyo Northside) created an issue

When opening a big project by OmegaT current master branch on Java 11 on Linux following error is happened and failed to open the project.

The error is observed with OkAPI plugin but is is JAXP error that caused by 'FEATURE_SECURE_PROCESSING' feature recently Oracle added to Java 11.

https://www.oracle.com/java/technologies/javase/11-0-15-relnotes.html

xml/jaxp

➜ New XML Processing Limits

Three processing limits have been added to the XML libraries. These are:

jdk.xml.xpathExprGrpLimit

Description: Limits the number of groups an XPath expression can contain.

Type: integer

Value: A positive integer. A value less than or equal to 0 indicates no limit. If the value is not an integer, a NumberFormatException is thrown. Default 10.

jdk.xml.xpathExprOpLimit

Description: Limits the number of operators an XPath expression can contain.

Type: integer

Value: A positive integer. A value less than or equal to 0 indicates no limit. If the value is not an integer, a NumberFormatException is thrown. Default 100.

jdk.xml.xpathTotalOpLimit

Description: Limits the total number of XPath operators in an XSL Stylesheet.

Type: integer

Value: A positive integer. A value less than or equal to 0 indicates no limit. If the value is not an integer, a NumberFormatException is thrown. Default 10000.

Supported processors

jdk.xml.xpathExprGrpLimit and jdk.xml.xpathExprOpLimit are supported by the XPath processor.

All three limits are supported by the XSLT processor.

Setting properties

For the XSLT processor, the properties can be changed through the TransformerFactory. For example,

‌ TransformerFactory factory = TransformerFactory.newInstance();

‌ factory.setAttribute("jdk.xml.xpathTotalOpLimit", "1000");

For both the XPath and XSLT processors, the properties can be set through the system property and jaxp.properties configuration file located in the conf directory of the Java installation. For example,

‌ System.setProperty("jdk.xml.xpathExprGrpLimit", "20");

or in the jaxp.properties file,

‌ jdk.xml.xpathExprGrpLimit=20

There are two known issues:

An XPath expression that contains a short form of the parent axis ".." can return incorrect results. See JDK-8284920 for details.

An invalid XPath expression that ends with a relational operator such as ‘<’ ‘>’ and ‘=’ will cause the processor to erroneously throw StringIndexOutOfBoundsException instead of XPathExpressionException. See JDK-8284548 for details.

JDK-8270504 (not public)

75238: Info: Version: 5.8.0_0_aac2c1e3e (TMXR_INFO_CREATION_TOOL_VERSION)
75238: Info: Segmentation method: sentence (TMXR_INFO_SEG_TYPE)
75238: Info: Source language: en (TMXR_INFO_SOURCE_LANG)
75238: Info: Reading of TMX file complete (TMXR_INFO_READING_COMPLETE)
75238: Info: Omtv= 5.8.0 flag2_5=true flag3_plus=true 
75238: Error: Failed to load specified project! (TF_LOAD_ERROR)
75238: Error: java.io.IOException: /home/miurahr/Projects/Translation/omegat-l10n-ja2/source/doc_src5/messages.xml 
75238: Error: 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'. 
75238: Error:   at org.omegat.filters2.master.FilterMaster.loadFile(FilterMaster.java:206) 
75238: Error:   at org.omegat.core.data.RealProject.loadSourceFiles(RealProject.java:1158) 
75238: Error:   at org.omegat.core.data.RealProject.loadProject(RealProject.java:360) 
75238: Error:   at org.omegat.core.data.ProjectFactory.loadProject(ProjectFactory.java:72) 
75238: Error:   at org.omegat.gui.main.ProjectUICommands$6.lambda$doInBackground$0(ProjectUICommands.java:546) 
75238: Error:   at org.omegat.core.Core.executeExclusively(Core.java:385) 
75238: Error:   at org.omegat.gui.main.ProjectUICommands$6.doInBackground(ProjectUICommands.java:544) 
75238: Error:   at org.omegat.gui.main.ProjectUICommands$6.doInBackground(ProjectUICommands.java:427) 
75238: Error:   at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304) 
75238: Error:   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
75238: Error:   at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343) 
75238: Error:   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
75238: Error:   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
75238: Error:   at java.base/java.lang.Thread.run(Thread.java:829) 
75238: Error: Caused by: 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'. 
75238: Error:   at org.w3c.its.ITSEngine.processLocalRules(ITSEngine.java:2444) 
75238: Error:   at org.w3c.its.ITSEngine.applyRules(ITSEngine.java:1255) 
75238: Error:   at net.sf.okapi.filters.its.ITSFilter.applyRules(ITSFilter.java:216) 
75238: Error:   at net.sf.okapi.filters.its.ITSFilter.open(ITSFilter.java:255) 
75238: Error:   at net.sf.okapi.filters.its.ITSFilter.open(ITSFilter.java:199) 
75238: Error:   at net.sf.okapi.lib.omegat.AbstractOkapiFilter.processFile(AbstractOkapiFilter.java:364) 
75238: Error:   at net.sf.okapi.lib.omegat.AbstractOkapiFilter.parseFile(AbstractOkapiFilter.java:208) 
75238: Error:   at net.sf.okapi.lib.omegat.XMLFilter.parseFile(XMLFilter.java:24) 
75238: Error:   at org.omegat.filters2.master.FilterMaster.loadFile(FilterMaster.java:204) 
75238: Error:   ... 13 more 
75238: Error: Caused by: 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'. 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:174) 
75238: Error:   at org.w3c.its.ITSEngine.processLocalRules(ITSEngine.java:2210) 
75238: Error:   ... 21 more 
75238: Error: Caused by: javax.xml.transform.TransformerException: JAXP0801002: the compiler encountered an XPath expression containing '101' operators that exceeds the '100' limit set by 'FEATURE_SECURE_PROCESSING'. 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Lexer.java:410) 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Lexer.java:129) 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.compiler.XPathParser.initXPath(XPathParser.java:121) 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.XPath.<init>(XPath.java:207) 
75238: Error:   at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:166) 
75238: Error:   ... 22 more 
75238: Info: Project loading end (LOG_DATAENGINE_LOAD_END)

Comments (5)

  1. Hiroshi Miura(Tokyo Northside) reporter

    version: okapiFiltersForOmegaT-1.11-1.43.0 OmegaT-5.8.0_0_833dd3e30 (Mon Sep 19 15:39:51 JST 2022) Locale en_JP

    platform: Mint Linux 21

    Java: openjdk 11.0.16 2022-07-19 OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu122.04)

  2. Hiroshi Miura(Tokyo Northside) reporter

    A work around is set system property jdk.xml.xpathExprOpLimit to be 0

  3. Log in to comment