Skip to content

Commit

Permalink
8306055: Add a built-in Catalog to JDK XML module
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang-Java committed Nov 17, 2023
1 parent 1588dd9 commit ed612c3
Show file tree
Hide file tree
Showing 50 changed files with 1,722 additions and 213 deletions.
1 change: 1 addition & 0 deletions make/modules/java.xml/Java.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ DISABLED_WARNINGS_java += lossy-conversions this-escape
DOCLINT += -Xdoclint:all/protected \
'-Xdoclint/package:$(call CommaList, javax.xml.catalog javax.xml.datatype \
javax.xml.transform javax.xml.validation javax.xml.xpath)'
COPY += .dtd .xsd .xml
CLEAN += .properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* @author K Venugopal
* @author Sunitha Reddy
*
* @LastModified: July 2023
* @LastModified: Nov 2023
*/
public class PropertyManager {

Expand Down Expand Up @@ -150,10 +150,7 @@ private void initConfigurableReaderProperties() {

// Initialize Catalog features
supportedProps.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
supportedProps.put(f.getPropertyName(), null);
}

JdkXmlUtils.initCatalogFeatures(supportedProps);
supportedProps.put(JdkConstants.CDATA_CHUNK_SIZE, JdkConstants.CDATA_CHUNK_SIZE_DEFAULT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
* @author Eric Ye, IBM
* @author Sunitha Reddy, SUN Microsystems
*
* @LastModified: July 2023
* @LastModified: Nov 2023
*/
public class XMLDocumentFragmentScannerImpl
extends XMLScanner
Expand Down Expand Up @@ -343,6 +343,13 @@ public class XMLDocumentFragmentScannerImpl
*/
protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;

/**
* Properties to determine whether to use a user-specified Catalog:
* Feature USE_CATALOG, Resolve and Catalog File
*/
protected boolean fUseCatalog = true;
protected String fCatalogFile;

/**
* standard uri conformant (strict uri).
* http://apache.org/xml/features/standard-uri-conformant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
import java.io.CharConversionException;
import java.io.EOFException;
import java.io.IOException;
import javax.xml.XMLConstants;
import javax.xml.stream.events.XMLEvent;
import jdk.xml.internal.JdkConstants;
import jdk.xml.internal.JdkProperty.State;
import jdk.xml.internal.JdkXmlUtils;
import jdk.xml.internal.SecuritySupport;
import jdk.xml.internal.XMLSecurityManager.Limit;

Expand All @@ -69,7 +71,7 @@
* Refer to the table in unit-test javax.xml.stream.XMLStreamReaderTest.SupportDTD for changes
* related to property SupportDTD.
* @author Joe Wang, Sun Microsystems
* @LastModified: July 2023
* @LastModified: Nov 2023
*/
public class XMLDocumentScannerImpl
extends XMLDocumentFragmentScannerImpl{
Expand Down Expand Up @@ -281,6 +283,9 @@ public void reset(PropertyManager propertyManager) {
fLoadExternalDTD = !((Boolean)propertyManager.getProperty(
Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD));

fUseCatalog = (Boolean)propertyManager.getProperty(XMLConstants.USE_CATALOG);
fCatalogFile = (String)propertyManager.getProperty(JdkXmlUtils.CATALOG_FILES);

setScannerState(XMLEvent.START_DOCUMENT);
setDriver(fXMLDeclDriver);
fSeenInternalSubset = false;
Expand Down Expand Up @@ -327,6 +332,8 @@ public void reset(XMLComponentManager componentManager)
// xerces features
fLoadExternalDTD = componentManager.getFeature(LOAD_EXTERNAL_DTD, true);

fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG, true);
fCatalogFile = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_FILES);
fNamespaces = componentManager.getFeature(NAMESPACES, true);

fSeenInternalSubset = false;
Expand Down
Loading

0 comments on commit ed612c3

Please sign in to comment.