Merge
This commit is contained in:
commit
34837ee9b7
@ -932,9 +932,9 @@ class FunctionCall extends Expression {
|
||||
//Check if FSP and SM - only then process with loading
|
||||
if (namespace != null && isSecureProcessing
|
||||
&& isExtensionFunctionEnabled
|
||||
&& (namespace.equals(JAVA_EXT_XALAN)
|
||||
|| namespace.equals(JAVA_EXT_XSLTC)
|
||||
|| namespace.equals(JAVA_EXT_XALAN_OLD)
|
||||
&& (namespace.startsWith(JAVA_EXT_XALAN)
|
||||
|| namespace.startsWith(JAVA_EXT_XSLTC)
|
||||
|| namespace.startsWith(JAVA_EXT_XALAN_OLD)
|
||||
|| namespace.startsWith(XALAN_CLASSPACKAGE_NAMESPACE))) {
|
||||
_clazz = getXSLTC().loadExternalFunction(_className);
|
||||
} else {
|
||||
|
@ -36,6 +36,7 @@ import com.sun.org.apache.xml.internal.serializer.ElemDesc;
|
||||
import com.sun.org.apache.xml.internal.serializer.ToHTMLStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -104,9 +105,9 @@ final class LiteralElement extends Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we have any declared namesaces
|
||||
// Check if we have any declared namespaces
|
||||
if (_accessedPrefixes == null) {
|
||||
_accessedPrefixes = new HashMap<>();
|
||||
_accessedPrefixes = new Hashtable<>();
|
||||
}
|
||||
else {
|
||||
if (!declared) {
|
||||
|
@ -331,7 +331,7 @@ public class XML11DocumentScannerImpl
|
||||
new Object[]{entityName});
|
||||
}
|
||||
}
|
||||
fEntityManager.startEntity(false, entityName, true);
|
||||
fEntityManager.startEntity(true, entityName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ public class XML11EntityScanner
|
||||
}
|
||||
int length = fCurrentEntity.position - offset;
|
||||
fCurrentEntity.columnNumber += length - newlines;
|
||||
if (fCurrentEntity.reference) {
|
||||
if (fCurrentEntity.isGE) {
|
||||
checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
|
||||
}
|
||||
content.setValues(fCurrentEntity.ch, offset, length);
|
||||
@ -1051,6 +1051,9 @@ public class XML11EntityScanner
|
||||
}
|
||||
int length = fCurrentEntity.position - offset;
|
||||
fCurrentEntity.columnNumber += length - newlines;
|
||||
if (fCurrentEntity.isGE) {
|
||||
checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
|
||||
}
|
||||
content.setValues(fCurrentEntity.ch, offset, length);
|
||||
|
||||
// return next character
|
||||
|
@ -1155,7 +1155,7 @@ public class XMLDocumentScannerImpl
|
||||
StaxXMLInputSource staxInputSource = fEntityManager.resolveEntityAsPerStax(resourceIdentifier);
|
||||
|
||||
// Check access permission. If the source is resolved by a resolver, the check is skipped.
|
||||
if (!staxInputSource.hasResolver()) {
|
||||
if (!staxInputSource.isCreatedByResolver()) {
|
||||
String accessError = checkAccess(fDoctypeSystemId, fAccessExternalDTD);
|
||||
if (accessError != null) {
|
||||
reportFatalError("AccessExternalDTD", new Object[]{ SecuritySupport.sanitizePath(fDoctypeSystemId), accessError });
|
||||
|
@ -1008,12 +1008,14 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
}
|
||||
|
||||
// do default resolution
|
||||
//this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
|
||||
//this works for both stax & Xerces, if staxInputSource is null,
|
||||
//it means parser need to revert to default resolution
|
||||
if (staxInputSource == null) {
|
||||
// REVISIT: when systemId is null, I think we should return null.
|
||||
// is this the right solution? -SG
|
||||
//if (systemId != null)
|
||||
staxInputSource = new StaxXMLInputSource(new XMLInputSource(publicId, literalSystemId, baseSystemId));
|
||||
staxInputSource = new StaxXMLInputSource(
|
||||
new XMLInputSource(publicId, literalSystemId, baseSystemId), false);
|
||||
}else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
|
||||
//Waiting for the clarification from EG. - nb
|
||||
}
|
||||
@ -1108,7 +1110,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
/**
|
||||
* Starts a named entity.
|
||||
*
|
||||
* @param reference flag to indicate whether the entity is an Entity Reference.
|
||||
* @param isGE flag to indicate whether the entity is a General Entity
|
||||
* @param entityName The name of the entity to start.
|
||||
* @param literal True if this entity is started within a literal
|
||||
* value.
|
||||
@ -1116,7 +1118,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
* @throws IOException Thrown on i/o error.
|
||||
* @throws XNIException Thrown by entity handler to signal an error.
|
||||
*/
|
||||
public void startEntity(boolean reference, String entityName, boolean literal)
|
||||
public void startEntity(boolean isGE, String entityName, boolean literal)
|
||||
throws IOException, XNIException {
|
||||
|
||||
// was entity declared?
|
||||
@ -1240,7 +1242,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
}
|
||||
|
||||
// start the entity
|
||||
startEntity(reference, entityName, xmlInputSource, literal, external);
|
||||
startEntity(isGE, entityName, xmlInputSource, literal, external);
|
||||
|
||||
} // startEntity(String,boolean)
|
||||
|
||||
@ -1289,7 +1291,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
* This method can be used to insert an application defined XML
|
||||
* entity stream into the parsing stream.
|
||||
*
|
||||
* @param reference flag to indicate whether the entity is an Entity Reference.
|
||||
* @param isGE flag to indicate whether the entity is a General Entity
|
||||
* @param name The name of the entity.
|
||||
* @param xmlInputSource The input source of the entity.
|
||||
* @param literal True if this entity is started within a
|
||||
@ -1299,12 +1301,12 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
* @throws IOException Thrown on i/o error.
|
||||
* @throws XNIException Thrown by entity handler to signal an error.
|
||||
*/
|
||||
public void startEntity(boolean reference, String name,
|
||||
public void startEntity(boolean isGE, String name,
|
||||
XMLInputSource xmlInputSource,
|
||||
boolean literal, boolean isExternal)
|
||||
throws IOException, XNIException {
|
||||
|
||||
String encoding = setupCurrentEntity(reference, name, xmlInputSource, literal, isExternal);
|
||||
String encoding = setupCurrentEntity(isGE, name, xmlInputSource, literal, isExternal);
|
||||
|
||||
//when entity expansion limit is set by the Application, we need to
|
||||
//check for the entity expansion limit set by the parser, if number of entity
|
||||
|
@ -1038,7 +1038,7 @@ public class XMLEntityScanner implements XMLLocator {
|
||||
}
|
||||
int length = fCurrentEntity.position - offset;
|
||||
fCurrentEntity.columnNumber += length - newlines;
|
||||
if (fCurrentEntity.reference) {
|
||||
if (fCurrentEntity.isGE) {
|
||||
checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
|
||||
}
|
||||
|
||||
@ -1205,6 +1205,9 @@ public class XMLEntityScanner implements XMLLocator {
|
||||
}
|
||||
int length = fCurrentEntity.position - offset;
|
||||
fCurrentEntity.columnNumber += length - newlines;
|
||||
if (fCurrentEntity.isGE) {
|
||||
checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
|
||||
}
|
||||
content.setValues(fCurrentEntity.ch, offset, length);
|
||||
|
||||
// return next character
|
||||
|
@ -946,7 +946,7 @@ public abstract class XMLScanner
|
||||
new Object[]{entityName});
|
||||
}
|
||||
}
|
||||
fEntityManager.startEntity(false, entityName, true);
|
||||
fEntityManager.startEntity(true, entityName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,8 +344,8 @@ public abstract class Entity {
|
||||
// to know that prolog is read
|
||||
public boolean xmlDeclChunkRead = false;
|
||||
|
||||
// flag to indicate whether the Entity is an Entity Reference
|
||||
public boolean reference = false;
|
||||
// flag to indicate whether the Entity is a General Entity
|
||||
public boolean isGE = false;
|
||||
|
||||
/** returns the name of the current encoding
|
||||
* @return current encoding name
|
||||
@ -391,11 +391,11 @@ public abstract class Entity {
|
||||
//
|
||||
|
||||
/** Constructs a scanned entity. */
|
||||
public ScannedEntity(boolean reference, String name,
|
||||
public ScannedEntity(boolean isGE, String name,
|
||||
XMLResourceIdentifier entityLocation,
|
||||
InputStream stream, Reader reader,
|
||||
String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
|
||||
this.reference = reference;
|
||||
this.isGE = isGE;
|
||||
this.name = name ;
|
||||
this.entityLocation = entityLocation;
|
||||
this.stream = stream;
|
||||
|
@ -71,12 +71,12 @@ public class StaxEntityResolverWrapper {
|
||||
if(object == null) return null ;
|
||||
|
||||
if(object instanceof java.io.InputStream){
|
||||
return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null));
|
||||
return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null), true);
|
||||
}
|
||||
else if(object instanceof XMLStreamReader){
|
||||
return new StaxXMLInputSource((XMLStreamReader)object) ;
|
||||
return new StaxXMLInputSource((XMLStreamReader)object, true) ;
|
||||
}else if(object instanceof XMLEventReader){
|
||||
return new StaxXMLInputSource((XMLEventReader)object) ;
|
||||
return new StaxXMLInputSource((XMLEventReader)object, true) ;
|
||||
}
|
||||
|
||||
return null ;
|
||||
|
@ -43,27 +43,22 @@ public class StaxXMLInputSource {
|
||||
XMLEventReader fEventReader ;
|
||||
XMLInputSource fInputSource ;
|
||||
|
||||
//indicate if the source is resolved by a resolver
|
||||
boolean fHasResolver = false;
|
||||
//indicates if the source is created by a resolver
|
||||
boolean fIsCreatedByResolver = false;
|
||||
|
||||
/** Creates a new instance of StaxXMLInputSource */
|
||||
public StaxXMLInputSource(XMLStreamReader streamReader) {
|
||||
public StaxXMLInputSource(XMLStreamReader streamReader, boolean byResolver) {
|
||||
fStreamReader = streamReader ;
|
||||
}
|
||||
|
||||
/** Creates a new instance of StaxXMLInputSource */
|
||||
public StaxXMLInputSource(XMLEventReader eventReader) {
|
||||
public StaxXMLInputSource(XMLEventReader eventReader, boolean byResolver) {
|
||||
fEventReader = eventReader ;
|
||||
}
|
||||
|
||||
public StaxXMLInputSource(XMLInputSource inputSource){
|
||||
public StaxXMLInputSource(XMLInputSource inputSource, boolean byResolver){
|
||||
fInputSource = inputSource ;
|
||||
|
||||
}
|
||||
|
||||
public StaxXMLInputSource(XMLInputSource inputSource, boolean hasResolver){
|
||||
fInputSource = inputSource ;
|
||||
fHasResolver = hasResolver;
|
||||
fIsCreatedByResolver = byResolver;
|
||||
}
|
||||
|
||||
public XMLStreamReader getXMLStreamReader(){
|
||||
@ -82,7 +77,7 @@ public class StaxXMLInputSource {
|
||||
return (fStreamReader == null) && (fEventReader == null) ? false : true ;
|
||||
}
|
||||
|
||||
public boolean hasResolver() {
|
||||
return fHasResolver;
|
||||
public boolean isCreatedByResolver() {
|
||||
return fIsCreatedByResolver;
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public interface XPath {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
|
||||
* @throws NullPointerException If {@code expression or type} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default <T>T evaluateExpression(String expression, Object item, Class<T> type)
|
||||
throws XPathExpressionException {
|
||||
@ -399,7 +399,7 @@ public interface XPath {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
|
||||
* @throws NullPointerException If {@code expression} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default XPathEvaluationResult<?> evaluateExpression(String expression, Object item)
|
||||
throws XPathExpressionException
|
||||
@ -445,7 +445,7 @@ public interface XPath {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
|
||||
* @throws NullPointerException If {@code expression, source or type}is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default <T>T evaluateExpression(String expression, InputSource source, Class<T> type)
|
||||
throws XPathExpressionException
|
||||
@ -486,7 +486,7 @@ public interface XPath {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
|
||||
* @throws NullPointerException If {@code expression or source} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default XPathEvaluationResult<?> evaluateExpression(String expression, InputSource source)
|
||||
throws XPathExpressionException
|
||||
|
@ -37,7 +37,7 @@ import org.w3c.dom.Node;
|
||||
* @see <a href="http://www.w3.org/TR/xpath">XML Path Language (XPath) Version
|
||||
* 1.0</a>
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
public interface XPathEvaluationResult<T> {
|
||||
|
||||
|
@ -246,7 +246,7 @@ public interface XPathExpression {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
|
||||
* @throws NullPointerException If {@code type} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default <T>T evaluateExpression(Object item, Class<T> type)
|
||||
throws XPathExpressionException
|
||||
@ -292,7 +292,7 @@ public interface XPathExpression {
|
||||
* does not support the
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default XPathEvaluationResult<?> evaluateExpression(Object item)
|
||||
throws XPathExpressionException
|
||||
@ -338,7 +338,7 @@ public interface XPathExpression {
|
||||
* is not available.
|
||||
* @throws NullPointerException If {@code source or type} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default <T>T evaluateExpression(InputSource source, Class<T> type)
|
||||
throws XPathExpressionException
|
||||
@ -377,7 +377,7 @@ public interface XPathExpression {
|
||||
* {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
|
||||
* @throws NullPointerException If {@code source} is {@code null}.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
default XPathEvaluationResult<?> evaluateExpression(InputSource source)
|
||||
throws XPathExpressionException
|
||||
|
@ -33,7 +33,7 @@ import org.w3c.dom.Node;
|
||||
* in <a href="http://www.w3.org/TR/xpath/#node-sets">XML Path Language (XPath)
|
||||
* Version 1.0, 3.3 Node-sets</a>.
|
||||
*
|
||||
* @since 1.9
|
||||
* @since 9
|
||||
*/
|
||||
public interface XPathNodes extends Iterable<Node> {
|
||||
|
||||
|
@ -43,7 +43,7 @@ package org.w3c.dom.ranges;
|
||||
|
||||
/**
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface DocumentRange {
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ import org.w3c.dom.DocumentFragment;
|
||||
|
||||
/**
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface Range {
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ package org.w3c.dom.ranges;
|
||||
* Range operations may throw a <code>RangeException</code> as specified in
|
||||
* their method descriptions.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public class RangeException extends RuntimeException {
|
||||
public RangeException(short code, String message) {
|
||||
|
@ -53,7 +53,7 @@ import org.w3c.dom.DOMException;
|
||||
* Traversal feature, <code>DocumentTraversal</code> will be implemented by
|
||||
* the same objects that implement the Document interface.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface DocumentTraversal {
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ import org.w3c.dom.Node;
|
||||
* filter may be used with a number of different kinds of traversals,
|
||||
* encouraging code reuse.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface NodeFilter {
|
||||
// Constants returned by acceptNode
|
||||
|
@ -55,7 +55,7 @@ import org.w3c.dom.DOMException;
|
||||
* <code>NodeIterators</code> are created by calling
|
||||
* <code>DocumentTraversal</code><code>.createNodeIterator()</code>.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface NodeIterator {
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ import org.w3c.dom.DOMException;
|
||||
* nodes will be siblings and appear as direct children of the root node, no
|
||||
* matter how deeply nested the structure of the original document.
|
||||
* <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
|
||||
* @since 1.9, DOM Level 2
|
||||
* @since 9, DOM Level 2
|
||||
*/
|
||||
public interface TreeWalker {
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user