Skip to content

Commit 2b2dcaa

Browse files
committed
8353234: Refactor XMLSecurityPropertyManager
1 parent 0b5a1cc commit 2b2dcaa

25 files changed

+143
-342
lines changed

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020

2121
package com.sun.org.apache.xalan.internal.xsltc.trax;
2222

23-
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
2423
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
25-
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
26-
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
2724
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
2825
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
2926
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@@ -69,6 +66,7 @@
6966
import javax.xml.transform.stax.*;
7067
import javax.xml.transform.stream.StreamResult;
7168
import javax.xml.transform.stream.StreamSource;
69+
import jdk.xml.internal.FeaturePropertyBase;
7270
import jdk.xml.internal.JdkConstants;
7371
import jdk.xml.internal.JdkProperty;
7472
import jdk.xml.internal.JdkXmlFeatures;
@@ -77,6 +75,8 @@
7775
import jdk.xml.internal.JdkProperty.State;
7876
import jdk.xml.internal.TransformErrorListener;
7977
import jdk.xml.internal.XMLSecurityManager;
78+
import jdk.xml.internal.XMLSecurityPropertyManager.Property;
79+
import jdk.xml.internal.XMLSecurityPropertyManager;
8080
import org.xml.sax.InputSource;
8181
import org.xml.sax.SAXException;
8282
import org.xml.sax.XMLFilter;
@@ -87,7 +87,7 @@
8787
* @author G. Todd Miller
8888
* @author Morten Jorgensen
8989
* @author Santiago Pericas-Geertsen
90-
* @LastModified: Feb 2025
90+
* @LastModified: Apr 2025
9191
*/
9292
public class TransformerFactoryImpl
9393
extends SAXTransformerFactory implements SourceLoader
@@ -520,7 +520,7 @@ else if (ImplPropMap.EXTCLSLOADER.is(name)) {
520520
}
521521

522522
if (_xmlSecurityPropertyMgr != null &&
523-
_xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
523+
_xmlSecurityPropertyMgr.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
524524
_accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
525525
Property.ACCESS_EXTERNAL_DTD);
526526
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -32,7 +32,6 @@
3232
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
3333
import com.sun.org.apache.xerces.internal.util.PropertyState;
3434
import com.sun.org.apache.xerces.internal.util.SymbolTable;
35-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
3635
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
3736
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
3837
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@@ -56,6 +55,7 @@
5655
import jdk.xml.internal.JdkConstants;
5756
import jdk.xml.internal.JdkXmlUtils;
5857
import jdk.xml.internal.XMLSecurityManager;
58+
import jdk.xml.internal.XMLSecurityPropertyManager;
5959
import org.w3c.dom.DOMConfiguration;
6060
import org.w3c.dom.DOMErrorHandler;
6161
import org.w3c.dom.DOMException;
@@ -71,7 +71,7 @@
7171
*
7272
* @author Elena Litani, IBM
7373
* @author Neeraj Bajaj, Sun Microsystems.
74-
* @LastModified: July 2023
74+
* @LastModified: Apr 2025
7575
*/
7676
public class DOMConfigurationImpl extends ParserConfigurationSettings
7777
implements XMLParserConfiguration, DOMConfiguration {

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,19 @@
2424
*/
2525
package com.sun.org.apache.xerces.internal.impl;
2626

27-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
2827
import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
2928
import java.util.HashMap;
3029
import javax.xml.XMLConstants;
3130
import javax.xml.catalog.CatalogFeatures;
3231
import javax.xml.stream.XMLInputFactory;
3332
import javax.xml.stream.XMLOutputFactory;
3433
import javax.xml.stream.XMLResolver;
34+
import jdk.xml.internal.FeaturePropertyBase;
3535
import jdk.xml.internal.JdkConstants;
3636
import jdk.xml.internal.JdkProperty;
3737
import jdk.xml.internal.JdkXmlUtils;
3838
import jdk.xml.internal.XMLSecurityManager;
39+
import jdk.xml.internal.XMLSecurityPropertyManager;
3940

4041
/**
4142
* This class manages the properties for the Stax specification and its
@@ -46,7 +47,7 @@
4647
* @author K Venugopal
4748
* @author Sunitha Reddy
4849
*
49-
* @LastModified: Jan 2024
50+
* @LastModified: Apr 2025
5051
*/
5152
public class PropertyManager {
5253

@@ -254,7 +255,7 @@ public void setProperty(String property, Object value) {
254255
|| !fSecurityManager.setLimit(property, JdkProperty.State.APIPROPERTY, value)) {
255256
//check if the property is managed by security property manager
256257
if (fSecurityPropertyMgr == null
257-
|| !fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
258+
|| !fSecurityPropertyMgr.setValue(property, FeaturePropertyBase.State.APIPROPERTY, value)) {
258259
//fall back to the existing property manager
259260
supportedProps.put(property, value);
260261
}

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44

55
/*
@@ -28,7 +28,6 @@
2828
import com.sun.org.apache.xerces.internal.util.XMLChar;
2929
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
3030
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
31-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
3231
import com.sun.org.apache.xerces.internal.xni.Augmentations;
3332
import com.sun.org.apache.xerces.internal.xni.QName;
3433
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
@@ -56,6 +55,7 @@
5655
import jdk.xml.internal.SecuritySupport;
5756
import jdk.xml.internal.XMLSecurityManager;
5857
import jdk.xml.internal.XMLSecurityManager.Limit;
58+
import jdk.xml.internal.XMLSecurityPropertyManager;
5959

6060
/**
6161
*
@@ -74,7 +74,7 @@
7474
* @author Eric Ye, IBM
7575
* @author Sunitha Reddy, SUN Microsystems
7676
*
77-
* @LastModified: Nov 2024
77+
* @LastModified: Apr 2025
7878
*/
7979
public class XMLDocumentFragmentScannerImpl
8080
extends XMLScanner

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -28,7 +28,6 @@
2828
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
2929
import com.sun.org.apache.xerces.internal.util.*;
3030
import com.sun.org.apache.xerces.internal.util.URI;
31-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
3231
import com.sun.org.apache.xerces.internal.xni.Augmentations;
3332
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
3433
import com.sun.org.apache.xerces.internal.xni.XNIException;
@@ -64,6 +63,7 @@
6463
import jdk.xml.internal.XMLLimitAnalyzer;
6564
import jdk.xml.internal.XMLSecurityManager;
6665
import jdk.xml.internal.XMLSecurityManager.Limit;
66+
import jdk.xml.internal.XMLSecurityPropertyManager;
6767
import org.xml.sax.InputSource;
6868

6969

@@ -94,7 +94,7 @@
9494
* @author K.Venugopal SUN Microsystems
9595
* @author Neeraj Bajaj SUN Microsystems
9696
* @author Sunitha Reddy SUN Microsystems
97-
* @LastModified: Nov 2024
97+
* @LastModified: Apr 2025
9898
*/
9999
public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
100100

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -41,7 +41,6 @@
4141
import com.sun.org.apache.xerces.internal.util.SymbolTable;
4242
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
4343
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
44-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
4544
import com.sun.org.apache.xerces.internal.xni.QName;
4645
import com.sun.org.apache.xerces.internal.xni.XNIException;
4746
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@@ -75,8 +74,9 @@
7574
import java.util.WeakHashMap;
7675
import javax.xml.XMLConstants;
7776
import jdk.xml.internal.JdkConstants;
78-
import jdk.xml.internal.XMLSecurityManager;
7977
import jdk.xml.internal.JdkXmlUtils;
78+
import jdk.xml.internal.XMLSecurityManager;
79+
import jdk.xml.internal.XMLSecurityPropertyManager;
8080
import jdk.xml.internal.SecuritySupport;
8181
import org.w3c.dom.DOMConfiguration;
8282
import org.w3c.dom.DOMError;
@@ -102,7 +102,7 @@
102102
* @xerces.internal
103103
*
104104
* @author Neil Graham, IBM
105-
* @LastModified: July 2023
105+
* @LastModified: Apr 2025
106106
*/
107107

108108
public class XMLSchemaLoader implements XMLGrammarLoader, XMLComponent, XSElementDeclHelper,

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
6363
import com.sun.org.apache.xerces.internal.util.XMLChar;
6464
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
65-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
6665
import com.sun.org.apache.xerces.internal.xni.QName;
6766
import com.sun.org.apache.xerces.internal.xni.XNIException;
6867
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@@ -109,6 +108,7 @@
109108
import jdk.xml.internal.JdkXmlUtils;
110109
import jdk.xml.internal.SecuritySupport;
111110
import jdk.xml.internal.XMLSecurityManager;
111+
import jdk.xml.internal.XMLSecurityPropertyManager;
112112
import org.w3c.dom.Document;
113113
import org.w3c.dom.Element;
114114
import org.w3c.dom.Node;
@@ -131,7 +131,7 @@
131131
* @author Neil Graham, IBM
132132
* @author Pavani Mukthipudi, Sun Microsystems
133133
*
134-
* @LastModified: Jan 2025
134+
* @LastModified: Apr 2025
135135
*/
136136
public class XSDHandler {
137137

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +22,6 @@
2222

2323
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
2424
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
25-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
2625
import java.util.HashMap;
2726
import java.util.Map;
2827
import javax.xml.XMLConstants;
@@ -32,14 +31,15 @@
3231
import javax.xml.validation.Schema;
3332
import jdk.xml.internal.JdkProperty;
3433
import jdk.xml.internal.XMLSecurityManager;
34+
import jdk.xml.internal.XMLSecurityPropertyManager;
3535
import org.xml.sax.SAXException;
3636
import org.xml.sax.SAXNotRecognizedException;
3737
import org.xml.sax.SAXNotSupportedException;
3838

3939
/**
4040
* @author Rajiv Mordani
4141
* @author Edwin Goei
42-
* @LastModified: Nov 2024
42+
* @LastModified: Apr 2025
4343
*/
4444
public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
4545
/** These are DocumentBuilderFactory attributes not DOM attributes */

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -35,18 +35,18 @@
3535
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
3636
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
3737
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
38-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
39-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.Property;
40-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.State;
4138
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
4239
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
4340
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
4441
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
4542
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
4643
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
44+
import jdk.xml.internal.FeaturePropertyBase.State;
4745
import jdk.xml.internal.JdkConstants;
4846
import jdk.xml.internal.JdkProperty;
4947
import jdk.xml.internal.XMLSecurityManager;
48+
import jdk.xml.internal.XMLSecurityPropertyManager;
49+
import jdk.xml.internal.XMLSecurityPropertyManager.Property;
5050
import org.w3c.dom.DOMImplementation;
5151
import org.w3c.dom.Document;
5252
import org.xml.sax.EntityResolver;
@@ -59,7 +59,7 @@
5959
/**
6060
* @author Rajiv Mordani
6161
* @author Edwin Goei
62-
* @LastModified: July 2023
62+
* @LastModified: Apr 2025
6363
*/
6464
public class DocumentBuilderImpl extends DocumentBuilder
6565
implements JAXPConstants
@@ -302,7 +302,7 @@ private void setDocumentBuilderFactoryAttributes( Map<String, Object> dbfAttrs)
302302
!fSecurityManager.setLimit(name, JdkProperty.State.APIPROPERTY, val)) {
303303
//check if the property is managed by security property manager
304304
if (fSecurityPropertyMgr == null ||
305-
!fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) {
305+
!fSecurityPropertyMgr.setValue(name, State.APIPROPERTY, val)) {
306306
//fall back to the existing property manager
307307
domParser.setProperty(name, val);
308308
}

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,8 +21,6 @@
2121
package com.sun.org.apache.xerces.internal.jaxp;
2222

2323
import com.sun.org.apache.xerces.internal.impl.Constants;
24-
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
25-
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
2624
import java.util.HashMap;
2725
import java.util.Map;
2826
import javax.xml.XMLConstants;
@@ -31,6 +29,7 @@
3129
import javax.xml.parsers.SAXParserFactory;
3230
import javax.xml.validation.Schema;
3331
import jdk.xml.internal.XMLSecurityManager;
32+
import jdk.xml.internal.XMLSecurityPropertyManager;
3433
import org.xml.sax.SAXException;
3534
import org.xml.sax.SAXNotRecognizedException;
3635
import org.xml.sax.SAXNotSupportedException;
@@ -43,7 +42,7 @@
4342
* @author Rajiv Mordani
4443
* @author Edwin Goei
4544
*
46-
* @LastModified: Nov 2024
45+
* @LastModified: Apr 2025
4746
*/
4847
public class SAXParserFactoryImpl extends SAXParserFactory {
4948

0 commit comments

Comments
 (0)