mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8353234: Refactor XMLSecurityPropertyManager
Reviewed-by: naoto, iris, lancea
This commit is contained in:
parent
cc870d4960
commit
209e72d311
@ -20,10 +20,7 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
|
||||
@ -69,6 +66,7 @@ import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stax.*;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
@ -77,6 +75,8 @@ import jdk.xml.internal.JdkProperty.ImplPropMap;
|
||||
import jdk.xml.internal.JdkProperty.State;
|
||||
import jdk.xml.internal.TransformErrorListener;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager.Property;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLFilter;
|
||||
@ -87,7 +87,7 @@ import org.xml.sax.XMLReader;
|
||||
* @author G. Todd Miller
|
||||
* @author Morten Jorgensen
|
||||
* @author Santiago Pericas-Geertsen
|
||||
* @LastModified: Feb 2025
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class TransformerFactoryImpl
|
||||
extends SAXTransformerFactory implements SourceLoader
|
||||
@ -520,7 +520,7 @@ public class TransformerFactoryImpl
|
||||
}
|
||||
|
||||
if (_xmlSecurityPropertyMgr != null &&
|
||||
_xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
|
||||
_xmlSecurityPropertyMgr.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
|
||||
_accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
|
||||
Property.ACCESS_EXTERNAL_DTD);
|
||||
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -32,7 +32,6 @@ import com.sun.org.apache.xerces.internal.util.MessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
|
||||
import com.sun.org.apache.xerces.internal.util.PropertyState;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
||||
@ -56,6 +55,7 @@ import javax.xml.catalog.CatalogFeatures;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMErrorHandler;
|
||||
import org.w3c.dom.DOMException;
|
||||
@ -71,7 +71,7 @@ import org.w3c.dom.ls.LSResourceResolver;
|
||||
*
|
||||
* @author Elena Litani, IBM
|
||||
* @author Neeraj Bajaj, Sun Microsystems.
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class DOMConfigurationImpl extends ParserConfigurationSettings
|
||||
implements XMLParserConfiguration, DOMConfiguration {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package com.sun.org.apache.xerces.internal.impl;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
|
||||
import java.util.HashMap;
|
||||
import javax.xml.XMLConstants;
|
||||
@ -32,10 +31,12 @@ import javax.xml.catalog.CatalogFeatures;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLResolver;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
* This class manages the properties for the Stax specification and its
|
||||
@ -46,7 +47,7 @@ import jdk.xml.internal.XMLSecurityManager;
|
||||
* @author K Venugopal
|
||||
* @author Sunitha Reddy
|
||||
*
|
||||
* @LastModified: Jan 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class PropertyManager {
|
||||
|
||||
@ -254,7 +255,7 @@ public class PropertyManager {
|
||||
|| !fSecurityManager.setLimit(property, JdkProperty.State.APIPROPERTY, value)) {
|
||||
//check if the property is managed by security property manager
|
||||
if (fSecurityPropertyMgr == null
|
||||
|| !fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
|
||||
|| !fSecurityPropertyMgr.setValue(property, FeaturePropertyBase.State.APIPROPERTY, value)) {
|
||||
//fall back to the existing property manager
|
||||
supportedProps.put(property, value);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -28,7 +28,6 @@ import com.sun.org.apache.xerces.internal.util.XMLAttributesIteratorImpl;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLChar;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.Augmentations;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
|
||||
@ -56,6 +55,7 @@ import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityManager.Limit;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -74,7 +74,7 @@ import jdk.xml.internal.XMLSecurityManager.Limit;
|
||||
* @author Eric Ye, IBM
|
||||
* @author Sunitha Reddy, SUN Microsystems
|
||||
*
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XMLDocumentFragmentScannerImpl
|
||||
extends XMLScanner
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -28,7 +28,6 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
||||
import com.sun.org.apache.xerces.internal.util.*;
|
||||
import com.sun.org.apache.xerces.internal.util.URI;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.Augmentations;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
@ -64,6 +63,7 @@ import jdk.xml.internal.SecuritySupport;
|
||||
import jdk.xml.internal.XMLLimitAnalyzer;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityManager.Limit;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ import org.xml.sax.InputSource;
|
||||
* @author K.Venugopal SUN Microsystems
|
||||
* @author Neeraj Bajaj SUN Microsystems
|
||||
* @author Sunitha Reddy SUN Microsystems
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -41,7 +41,6 @@ import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
|
||||
@ -75,8 +74,9 @@ import java.util.StringTokenizer;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.xml.XMLConstants;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMError;
|
||||
@ -102,7 +102,7 @@ import org.xml.sax.InputSource;
|
||||
* @xerces.internal
|
||||
*
|
||||
* @author Neil Graham, IBM
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
|
||||
public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElementDeclHelper,
|
||||
|
||||
@ -62,7 +62,6 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLChar;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
|
||||
@ -109,6 +108,7 @@ import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@ -131,7 +131,7 @@ import org.xml.sax.XMLReader;
|
||||
* @author Neil Graham, IBM
|
||||
* @author Pavani Mukthipudi, Sun Microsystems
|
||||
*
|
||||
* @LastModified: Jan 2025
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XSDHandler {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,7 +22,6 @@ package com.sun.org.apache.xerces.internal.jaxp;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.XMLConstants;
|
||||
@ -32,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.validation.Schema;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
@ -39,7 +39,7 @@ import org.xml.sax.SAXNotSupportedException;
|
||||
/**
|
||||
* @author Rajiv Mordani
|
||||
* @author Edwin Goei
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
|
||||
/** These are DocumentBuilderFactory attributes not DOM attributes */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -35,18 +35,18 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
|
||||
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.Property;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.State;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
||||
import jdk.xml.internal.FeaturePropertyBase.State;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager.Property;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.EntityResolver;
|
||||
@ -59,7 +59,7 @@ import org.xml.sax.SAXNotSupportedException;
|
||||
/**
|
||||
* @author Rajiv Mordani
|
||||
* @author Edwin Goei
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class DocumentBuilderImpl extends DocumentBuilder
|
||||
implements JAXPConstants
|
||||
@ -302,7 +302,7 @@ public class DocumentBuilderImpl extends DocumentBuilder
|
||||
!fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, val)) {
|
||||
//check if the property is managed by security property manager
|
||||
if (fSecurityPropertyMgr == null ||
|
||||
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) {
|
||||
!fSecurityPropertyMgr.setValue(name, State.APIPROPERTY, val)) {
|
||||
//fall back to the existing property manager
|
||||
domParser.setProperty(name, val);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
package com.sun.org.apache.xerces.internal.jaxp;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.XMLConstants;
|
||||
@ -31,6 +29,7 @@ import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.validation.Schema;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
@ -43,7 +42,7 @@ import org.xml.sax.SAXNotSupportedException;
|
||||
* @author Rajiv Mordani
|
||||
* @author Edwin Goei
|
||||
*
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class SAXParserFactoryImpl extends SAXParserFactory {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -26,7 +26,6 @@ import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
|
||||
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
|
||||
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||
@ -42,9 +41,11 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.validation.Schema;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.HandlerBase;
|
||||
@ -63,7 +64,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
* @author Rajiv Mordani
|
||||
* @author Edwin Goei
|
||||
*
|
||||
* @LastModified: Nov 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SAXParserImpl extends javax.xml.parsers.SAXParser
|
||||
@ -169,9 +170,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
|
||||
Boolean temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING);
|
||||
if (temp != null && temp) {
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -573,7 +574,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser
|
||||
!fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value)) {
|
||||
//check if the property is managed by security property manager
|
||||
if (fSecurityPropertyMgr == null ||
|
||||
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
|
||||
!fSecurityPropertyMgr.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
|
||||
//fall back to the existing property manager
|
||||
if (!fInitProperties.containsKey(name)) {
|
||||
fInitProperties.put(name, super.getProperty(name));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -35,7 +35,6 @@ import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.URI;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.Augmentations;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
@ -68,8 +67,9 @@ import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.validation.TypeInfoProvider;
|
||||
import javax.xml.validation.ValidatorHandler;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.TypeInfo;
|
||||
import org.w3c.dom.ls.LSInput;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
@ -93,7 +93,7 @@ import org.xml.sax.ext.EntityResolver2;
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @author Michael Glavassevich, IBM
|
||||
*
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
final class ValidatorHandlerImpl extends ValidatorHandler implements
|
||||
DTDHandler, EntityState, PSVIProvider, ValidatorHelper, XMLDocumentHandler {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -30,7 +30,6 @@ import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.util.StAXInputSource;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
|
||||
@ -50,12 +49,14 @@ import javax.xml.transform.stax.StAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.JdkProperty.ImplPropMap;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
@ -70,7 +71,7 @@ import org.xml.sax.SAXParseException;
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public final class XMLSchemaFactory extends SchemaFactory {
|
||||
|
||||
@ -444,9 +445,9 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
fSecurityManager.setSecureProcessing(value);
|
||||
if (value) {
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
}
|
||||
|
||||
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
|
||||
@ -517,7 +518,7 @@ public final class XMLSchemaFactory extends SchemaFactory {
|
||||
!fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, object)) {
|
||||
//check if the property is managed by security property manager
|
||||
if (fSecurityPropertyMgr == null ||
|
||||
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, object)) {
|
||||
!fSecurityPropertyMgr.setValue(name, FeaturePropertyBase.State.APIPROPERTY, object)) {
|
||||
//fall back to the existing property manager
|
||||
fXMLSchemaLoader.setProperty(name, object);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -40,16 +40,17 @@ import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
|
||||
import com.sun.org.apache.xerces.internal.util.PropertyState;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
|
||||
@ -57,7 +58,7 @@ import org.xml.sax.ErrorHandler;
|
||||
* <p>An implementation of XMLComponentManager for a schema validator.</p>
|
||||
*
|
||||
* @author Michael Glavassevich, IBM
|
||||
* @LastModified: Nov 2024
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettings implements
|
||||
XMLComponentManager {
|
||||
@ -376,9 +377,9 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
|
||||
|
||||
if (value) {
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
|
||||
XMLSecurityPropertyManager.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
FeaturePropertyBase.State.FSP, JdkConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
|
||||
setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
|
||||
}
|
||||
|
||||
@ -456,7 +457,7 @@ final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettin
|
||||
!fInitSecurityManager.setLimit(propertyId, JdkProperty.State.APIPROPERTY, value)) {
|
||||
//check if the property is managed by security property manager
|
||||
if (fSecurityPropertyMgr == null ||
|
||||
!fSecurityPropertyMgr.setValue(propertyId, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
|
||||
!fSecurityPropertyMgr.setValue(propertyId, FeaturePropertyBase.State.APIPROPERTY, value)) {
|
||||
//fall back to the existing property manager
|
||||
if (!fInitProperties.containsKey(propertyId)) {
|
||||
fInitProperties.put(propertyId, super.getProperty(propertyId));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -29,7 +29,6 @@ import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper;
|
||||
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
|
||||
@ -39,9 +38,11 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
||||
import java.io.CharConversionException;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
@ -60,7 +61,7 @@ import org.xml.sax.helpers.LocatorImpl;
|
||||
*
|
||||
* @author Arnaud Le Hors, IBM
|
||||
* @author Andy Clark, IBM
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class DOMParser
|
||||
extends AbstractDOMParser {
|
||||
@ -574,7 +575,7 @@ public class DOMParser
|
||||
* internally the support of this property is done through
|
||||
* XMLSecurityPropertyManager
|
||||
*/
|
||||
securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
|
||||
securityPropertyManager.setValue(index, FeaturePropertyBase.State.APIPROPERTY, (String)value);
|
||||
} else {
|
||||
//check if the property is managed by security manager
|
||||
if (!securityManager.setLimit(propertyId, JdkProperty.State.APIPROPERTY, value)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -37,7 +37,6 @@ import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
|
||||
import com.sun.org.apache.xerces.internal.util.FeatureState;
|
||||
import com.sun.org.apache.xerces.internal.util.PropertyState;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLLocator;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
|
||||
@ -52,6 +51,7 @@ import javax.xml.XMLConstants;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
* This is the DTD-only parser configuration. It extends the basic
|
||||
@ -89,7 +89,7 @@ import jdk.xml.internal.JdkXmlUtils;
|
||||
* @author Arnaud Le Hors, IBM
|
||||
* @author Andy Clark, IBM
|
||||
* @author Neil Graham, IBM
|
||||
* @LastModified: May 2021
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class DTDConfiguration
|
||||
extends BasicParserConfiguration
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -36,7 +36,6 @@ import com.sun.org.apache.xerces.internal.util.FeatureState;
|
||||
import com.sun.org.apache.xerces.internal.util.PropertyState;
|
||||
import com.sun.org.apache.xerces.internal.util.Status;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLLocator;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
|
||||
@ -51,6 +50,7 @@ import javax.xml.XMLConstants;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
* This is the non validating parser configuration. It extends the basic
|
||||
@ -63,7 +63,7 @@ import jdk.xml.internal.JdkXmlUtils;
|
||||
* include the replacement text of internal entities, and supply default attribute values".
|
||||
*
|
||||
* @author Elena Litani, IBM
|
||||
* @LastModified: May 2021
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class NonValidatingConfiguration
|
||||
extends BasicParserConfiguration
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,13 +22,14 @@ package com.sun.org.apache.xerces.internal.parsers;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
||||
import jdk.xml.internal.FeaturePropertyBase;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkProperty;
|
||||
import jdk.xml.internal.Utils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
@ -41,7 +42,7 @@ import org.xml.sax.SAXNotSupportedException;
|
||||
* @author Arnaud Le Hors, IBM
|
||||
* @author Andy Clark, IBM
|
||||
*
|
||||
* @LastModified: Nov 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class SAXParser
|
||||
extends AbstractSAXParser {
|
||||
@ -168,7 +169,7 @@ public class SAXParser
|
||||
* internally the support of this property is done through
|
||||
* XMLSecurityPropertyManager
|
||||
*/
|
||||
securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
|
||||
securityPropertyManager.setValue(index, FeaturePropertyBase.State.APIPROPERTY, (String)value);
|
||||
} else {
|
||||
//check if the property is managed by security manager
|
||||
if (!securityManager.setLimit(name, JdkProperty.State.APIPROPERTY, value)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -24,7 +24,6 @@ import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.util.FeatureState;
|
||||
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler;
|
||||
import com.sun.org.apache.xerces.internal.xinclude.XIncludeNamespaceSupport;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
@ -34,6 +33,7 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
* This class is the configuration used to parse XML 1.0 and XML 1.1 documents
|
||||
@ -41,7 +41,7 @@ import jdk.xml.internal.XMLSecurityManager;
|
||||
*
|
||||
* @author Michael Glavassevich, IBM
|
||||
*
|
||||
* @LastModified: Nov 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XIncludeAwareParserConfiguration extends XML11Configuration {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -46,7 +46,6 @@ import com.sun.org.apache.xerces.internal.util.FeatureState;
|
||||
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
|
||||
import com.sun.org.apache.xerces.internal.util.PropertyState;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
|
||||
@ -72,6 +71,7 @@ import javax.xml.catalog.CatalogFeatures;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
|
||||
/**
|
||||
* This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
|
||||
@ -80,7 +80,7 @@ import jdk.xml.internal.XMLSecurityManager;
|
||||
* @author Neil Graham, IBM
|
||||
* @author Michael Glavassevich, IBM
|
||||
*
|
||||
* @LastModified: Nov 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XML11Configuration extends ParserConfigurationSettings
|
||||
implements XMLPullParserConfiguration, XML11Configurable {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,13 +23,13 @@ package com.sun.org.apache.xerces.internal.parsers;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.Utils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
@ -50,7 +50,7 @@ import org.xml.sax.SAXNotRecognizedException;
|
||||
*
|
||||
* @author Arnaud Le Hors, IBM
|
||||
* @author Andy Clark, IBM
|
||||
* @LastModified: Nov 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public abstract class XMLParser {
|
||||
|
||||
|
||||
@ -1,243 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xerces.internal.utils;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
|
||||
/**
|
||||
* This class manages security related properties
|
||||
*
|
||||
*/
|
||||
public final class XMLSecurityPropertyManager {
|
||||
|
||||
/**
|
||||
* States of the settings of a property, in the order: default value, value
|
||||
* set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
|
||||
* properties, and jaxp api properties
|
||||
*/
|
||||
public static enum State {
|
||||
//this order reflects the overriding order
|
||||
DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits managed by the security manager
|
||||
*/
|
||||
public static enum Property {
|
||||
ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
JdkConstants.EXTERNAL_ACCESS_DEFAULT),
|
||||
ACCESS_EXTERNAL_SCHEMA(XMLConstants.ACCESS_EXTERNAL_SCHEMA,
|
||||
JdkConstants.EXTERNAL_ACCESS_DEFAULT);
|
||||
|
||||
final String name;
|
||||
final String defaultValue;
|
||||
|
||||
Property(String name, String value) {
|
||||
this.name = name;
|
||||
this.defaultValue = value;
|
||||
}
|
||||
|
||||
public boolean equalsName(String propertyName) {
|
||||
return (propertyName == null) ? false : name.equals(propertyName);
|
||||
}
|
||||
|
||||
public String propertyName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
String defaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Values of the properties as defined in enum Properties
|
||||
*/
|
||||
private final String[] values;
|
||||
/**
|
||||
* States of the settings for each property in Properties above
|
||||
*/
|
||||
private State[] states = {State.DEFAULT, State.DEFAULT};
|
||||
|
||||
/**
|
||||
* Default constructor. Establishes default values
|
||||
*/
|
||||
public XMLSecurityPropertyManager() {
|
||||
values = new String[Property.values().length];
|
||||
for (Property property : Property.values()) {
|
||||
values[property.ordinal()] = property.defaultValue();
|
||||
}
|
||||
//read system properties or jaxp.properties
|
||||
readSystemProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the property with the given name.
|
||||
* @param propertyName the property name specified
|
||||
* @return the property name if found, null otherwise
|
||||
*/
|
||||
public String find(String propertyName) {
|
||||
for (Property property : Property.values()) {
|
||||
if (property.equalsName(propertyName)) {
|
||||
return property.propertyName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set limit by property name and state
|
||||
* @param propertyName property name
|
||||
* @param state the state of the property
|
||||
* @param value the value of the property
|
||||
* @return true if the property is managed by the security property manager;
|
||||
* false if otherwise.
|
||||
*/
|
||||
public boolean setValue(String propertyName, State state, Object value) {
|
||||
int index = getIndex(propertyName);
|
||||
if (index > -1) {
|
||||
setValue(index, state, (String)value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for a specific property.
|
||||
*
|
||||
* @param property the property
|
||||
* @param state the state of the property
|
||||
* @param value the value of the property
|
||||
*/
|
||||
public void setValue(Property property, State state, String value) {
|
||||
//only update if it shall override
|
||||
if (state.compareTo(states[property.ordinal()]) >= 0) {
|
||||
values[property.ordinal()] = value;
|
||||
states[property.ordinal()] = state;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a property by its index
|
||||
* @param index the index of the property
|
||||
* @param state the state of the property
|
||||
* @param value the value of the property
|
||||
*/
|
||||
public void setValue(int index, State state, String value) {
|
||||
//only update if it shall override
|
||||
if (state.compareTo(states[index]) >= 0) {
|
||||
values[index] = value;
|
||||
states[index] = state;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of the specified property
|
||||
*
|
||||
* @param propertyName the property name
|
||||
* @return the value of the property as a string
|
||||
*/
|
||||
public String getValue(String propertyName) {
|
||||
int index = getIndex(propertyName);
|
||||
if (index > -1) {
|
||||
return getValueByIndex(index);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the specified property
|
||||
*
|
||||
* @param property the property
|
||||
* @return the value of the property
|
||||
*/
|
||||
public String getValue(Property property) {
|
||||
return values[property.ordinal()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of a property by its ordinal
|
||||
* @param index the index of a property
|
||||
* @return value of a property
|
||||
*/
|
||||
public String getValueByIndex(int index) {
|
||||
return values[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index by property name
|
||||
* @param propertyName property name
|
||||
* @return the index of the property if found; return -1 if not
|
||||
*/
|
||||
public int getIndex(String propertyName){
|
||||
for (Property property : Property.values()) {
|
||||
if (property.equalsName(propertyName)) {
|
||||
//internally, ordinal is used as index
|
||||
return property.ordinal();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from system properties, or those in jaxp.properties
|
||||
*/
|
||||
private void readSystemProperties() {
|
||||
getSystemProperty(Property.ACCESS_EXTERNAL_DTD,
|
||||
JdkConstants.SP_ACCESS_EXTERNAL_DTD);
|
||||
getSystemProperty(Property.ACCESS_EXTERNAL_SCHEMA,
|
||||
JdkConstants.SP_ACCESS_EXTERNAL_SCHEMA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from system properties, or those in jaxp.properties
|
||||
*
|
||||
* @param property the property
|
||||
* @param systemProperty the name of the system property
|
||||
*/
|
||||
private void getSystemProperty(Property property, String systemProperty) {
|
||||
try {
|
||||
String value = System.getProperty(systemProperty);
|
||||
if (value != null) {
|
||||
values[property.ordinal()] = value;
|
||||
states[property.ordinal()] = State.SYSTEMPROPERTY;
|
||||
return;
|
||||
}
|
||||
|
||||
value = SecuritySupport.readConfig(systemProperty);
|
||||
if (value != null) {
|
||||
values[property.ordinal()] = value;
|
||||
states[property.ordinal()] = State.JAXPDOTPROPERTIES;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
//invalid setting ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -39,7 +39,6 @@ import com.sun.org.apache.xerces.internal.util.XMLChar;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLLocatorWrapper;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
|
||||
import com.sun.org.apache.xerces.internal.xni.Augmentations;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
@ -80,6 +79,7 @@ import javax.xml.transform.Source;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.XMLSecurityManager;
|
||||
import jdk.xml.internal.XMLSecurityPropertyManager;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ import org.xml.sax.InputSource;
|
||||
*
|
||||
*
|
||||
* @see XIncludeNamespaceSupport
|
||||
* @LastModified: July 2023
|
||||
* @LastModified: Apr 2025
|
||||
*/
|
||||
public class XIncludeHandler
|
||||
implements XMLComponent, XMLDocumentFilter, XMLDTDFilter {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,15 +23,10 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.utils;
|
||||
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
package jdk.xml.internal;
|
||||
|
||||
/**
|
||||
* This is the base class for features and properties
|
||||
*
|
||||
* @LastModified: Nov 2024
|
||||
*/
|
||||
public abstract class FeaturePropertyBase {
|
||||
|
||||
@ -53,7 +48,7 @@ public abstract class FeaturePropertyBase {
|
||||
/**
|
||||
* States of the settings for each property in Properties above
|
||||
*/
|
||||
State[] states = {State.DEFAULT, State.DEFAULT};
|
||||
State[] states = {State.DEFAULT, State.DEFAULT, State.DEFAULT};
|
||||
|
||||
|
||||
/**
|
||||
@ -85,7 +80,7 @@ public abstract class FeaturePropertyBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set value by property name and state
|
||||
* @param propertyName property name
|
||||
* @param state the state of the property
|
||||
@ -102,7 +97,7 @@ public abstract class FeaturePropertyBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set value by property name and state
|
||||
* @param propertyName property name
|
||||
* @param state the state of the property
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,10 +23,9 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.utils;
|
||||
package jdk.xml.internal;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import jdk.xml.internal.JdkConstants;
|
||||
|
||||
/**
|
||||
* This class manages security related properties
|
||||
@ -40,6 +39,8 @@ public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
|
||||
public static enum Property {
|
||||
ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
JdkConstants.EXTERNAL_ACCESS_DEFAULT),
|
||||
ACCESS_EXTERNAL_SCHEMA(XMLConstants.ACCESS_EXTERNAL_SCHEMA,
|
||||
JdkConstants.EXTERNAL_ACCESS_DEFAULT),
|
||||
ACCESS_EXTERNAL_STYLESHEET(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,
|
||||
JdkConstants.EXTERNAL_ACCESS_DEFAULT);
|
||||
|
||||
@ -55,12 +56,14 @@ public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
|
||||
return (propertyName == null) ? false : name.equals(propertyName);
|
||||
}
|
||||
|
||||
public String propertyName() {
|
||||
return name;
|
||||
}
|
||||
String defaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor. Establishes default values
|
||||
*/
|
||||
@ -73,6 +76,20 @@ public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
|
||||
readSystemProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the property with the given name.
|
||||
* @param propertyName the property name specified
|
||||
* @return the property name if found, null otherwise
|
||||
*/
|
||||
public String find(String propertyName) {
|
||||
for (Property property : Property.values()) {
|
||||
if (property.equalsName(propertyName)) {
|
||||
return property.propertyName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index by property name
|
||||
* @param propertyName property name
|
||||
@ -88,12 +105,39 @@ public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for a specific property.
|
||||
*
|
||||
* @param property the property
|
||||
* @param state the state of the property
|
||||
* @param value the value of the property
|
||||
*/
|
||||
public void setValue(Property property, State state, String value) {
|
||||
//only update if it shall override
|
||||
if (state.compareTo(states[property.ordinal()]) >= 0) {
|
||||
values[property.ordinal()] = value;
|
||||
states[property.ordinal()] = state;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the specified property
|
||||
*
|
||||
* @param property the property
|
||||
* @return the value of the property
|
||||
*/
|
||||
public String getValue(Property property) {
|
||||
return values[property.ordinal()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from system properties, or those in jaxp.properties
|
||||
*/
|
||||
private void readSystemProperties() {
|
||||
getSystemProperty(Property.ACCESS_EXTERNAL_DTD,
|
||||
JdkConstants.SP_ACCESS_EXTERNAL_DTD);
|
||||
getSystemProperty(Property.ACCESS_EXTERNAL_SCHEMA,
|
||||
JdkConstants.SP_ACCESS_EXTERNAL_SCHEMA);
|
||||
getSystemProperty(Property.ACCESS_EXTERNAL_STYLESHEET,
|
||||
JdkConstants.SP_ACCESS_EXTERNAL_STYLESHEET);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user