Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XERCESJ-1659: Assertions of JAXPSecureProcessingTest require numbers formatted with English locale #1

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/jaxp/JAXPSecureProcessingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package jaxp;

import java.io.IOException;
import java.util.Locale;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
Expand Down Expand Up @@ -54,25 +55,30 @@ public class JAXPSecureProcessingTest extends TestCase {
private static final String MAX_GENERAL_ENTITY_SIZE_LIMIT_PROPERTY_NAME = "jdk.xml.maxGeneralEntitySizeLimit";
private static final String MAX_PARAMETER_ENTITY_SIZE_LIMIT_PROPERTY_NAME = "jdk.xml.maxParameterEntitySizeLimit";
private static final String RESOLVE_EXTERNAL_ENTITIES_PROPERTY_NAME = "jdk.xml.resolveExternalEntities";

private static final Locale DEFAULT_LOCALE = Locale.getDefault();

protected void setUp() throws Exception {
super.setUp();
System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI,
System.setProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI,
"org.apache.xerces.jaxp.validation.XMLSchemaFactory");
System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.SecureProcessingConfiguration");
System.setProperty(ENTITY_EXPANSION_LIMIT_PROPERTY_NAME, "0");
System.setProperty(MAX_OCCUR_LIMIT_PROPERTY_NAME, "0");
System.setProperty(TOTAL_ENTITY_SIZE_LIMIT_PROPERTY_NAME, "0");
System.setProperty(MAX_GENERAL_ENTITY_SIZE_LIMIT_PROPERTY_NAME, "0");
System.setProperty(MAX_PARAMETER_ENTITY_SIZE_LIMIT_PROPERTY_NAME, "0");
System.setProperty(RESOLVE_EXTERNAL_ENTITIES_PROPERTY_NAME, "true");
// English Locale required for the exception message assertions to match the correct number format
Locale.setDefault(Locale.ENGLISH);
}

protected void tearDown() throws Exception {
super.tearDown();
Locale.setDefault(DEFAULT_LOCALE);
}

public void testSAXEntityExpansionLimitSG() throws Exception {
Expand Down