jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java
Print this page
*** 65,74 ****
--- 65,75 ----
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
import com.sun.org.apache.xerces.internal.xpointer.XPointerHandler;
import com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
+ import java.util.Objects;
/**
* <p>
* This is a pipeline component which performs XInclude handling, according to the
* W3C specification for XML Inclusions.
*** 373,382 ****
--- 374,384 ----
fCurrentLanguage = null;
}
// XMLComponent methods
+ @Override
public void reset(XMLComponentManager componentManager)
throws XNIException {
fNamespaceContext = null;
fDepth = 0;
fResultDepth = isRootDocument() ? 0 : fParentXIncludeHandler.getResultDepth();
*** 578,587 ****
--- 580,590 ----
/**
* Returns a list of feature identifiers that are recognized by
* this component. This method may return null if no features
* are recognized by this component.
*/
+ @Override
public String[] getRecognizedFeatures() {
return (String[])(RECOGNIZED_FEATURES.clone());
} // getRecognizedFeatures():String[]
/**
*** 597,606 ****
--- 600,610 ----
* @throws SAXNotRecognizedException The component should not throw
* this exception.
* @throws SAXNotSupportedException The component should not throw
* this exception.
*/
+ @Override
public void setFeature(String featureId, boolean state)
throws XMLConfigurationException {
if (featureId.equals(ALLOW_UE_AND_NOTATION_EVENTS)) {
fSendUEAndNotationEvents = state;
}
*** 613,622 ****
--- 617,627 ----
/**
* Returns a list of property identifiers that are recognized by
* this component. This method may return null if no properties
* are recognized by this component.
*/
+ @Override
public String[] getRecognizedProperties() {
return (String[])(RECOGNIZED_PROPERTIES.clone());
} // getRecognizedProperties():String[]
/**
*** 632,641 ****
--- 637,647 ----
* @throws SAXNotRecognizedException The component should not throw
* this exception.
* @throws SAXNotSupportedException The component should not throw
* this exception.
*/
+ @Override
public void setProperty(String propertyId, Object value)
throws XMLConfigurationException {
if (propertyId.equals(SYMBOL_TABLE)) {
fSymbolTable = (SymbolTable)value;
if (fChildConfig != null) {
*** 692,701 ****
--- 698,708 ----
*
* @param featureId The feature identifier.
*
* @since Xerces 2.2.0
*/
+ @Override
public Boolean getFeatureDefault(String featureId) {
for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
if (RECOGNIZED_FEATURES[i].equals(featureId)) {
return FEATURE_DEFAULTS[i];
}
*** 710,732 ****
--- 717,742 ----
*
* @param propertyId The property identifier.
*
* @since Xerces 2.2.0
*/
+ @Override
public Object getPropertyDefault(String propertyId) {
for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {
if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {
return PROPERTY_DEFAULTS[i];
}
}
return null;
} // getPropertyDefault(String):Object
+ @Override
public void setDocumentHandler(XMLDocumentHandler handler) {
fDocumentHandler = handler;
}
+ @Override
public XMLDocumentHandler getDocumentHandler() {
return fDocumentHandler;
}
// XMLDocumentHandler methods
*** 737,746 ****
--- 747,757 ----
* A fatal error will occur here, if it is detected that this document has been processed
* before.
*
* This event is only passed on to the document handler if this is the root document.
*/
+ @Override
public void startDocument(
XMLLocator locator,
String encoding,
NamespaceContext namespaceContext,
Augmentations augs)
*** 784,793 ****
--- 795,805 ----
namespaceContext,
augs);
}
}
+ @Override
public void xmlDecl(
String version,
String encoding,
String standalone,
Augmentations augs)
*** 796,805 ****
--- 808,818 ----
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.xmlDecl(version, encoding, standalone, augs);
}
}
+ @Override
public void doctypeDecl(
String rootElement,
String publicId,
String systemId,
Augmentations augs)
*** 807,816 ****
--- 820,830 ----
if (isRootDocument() && fDocumentHandler != null) {
fDocumentHandler.doctypeDecl(rootElement, publicId, systemId, augs);
}
}
+ @Override
public void comment(XMLString text, Augmentations augs)
throws XNIException {
if (!fInDTD) {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
*** 823,832 ****
--- 837,847 ----
else if (fDTDHandler != null) {
fDTDHandler.comment(text, augs);
}
}
+ @Override
public void processingInstruction(
String target,
XMLString data,
Augmentations augs)
throws XNIException {
*** 843,852 ****
--- 858,868 ----
else if (fDTDHandler != null) {
fDTDHandler.processingInstruction(target, data, augs);
}
}
+ @Override
public void startElement(
QName element,
XMLAttributes attributes,
Augmentations augs)
throws XNIException {
*** 913,922 ****
--- 929,939 ----
fDocumentHandler.startElement(element, attributes, augs);
}
}
}
+ @Override
public void emptyElement(
QName element,
XMLAttributes attributes,
Augmentations augs)
throws XNIException {
*** 994,1003 ****
--- 1011,1021 ----
restoreBaseURI();
}
fDepth--;
}
+ @Override
public void endElement(QName element, Augmentations augs)
throws XNIException {
if (isIncludeElement(element)) {
// if we're ending an include element, and we were expecting a fallback
*** 1039,1048 ****
--- 1057,1067 ----
}
fDepth--;
}
+ @Override
public void startGeneralEntity(
String name,
XMLResourceIdentifier resId,
String encoding,
Augmentations augs)
*** 1057,1083 ****
--- 1076,1105 ----
fDocumentHandler.startGeneralEntity(name, resId, encoding, augs);
}
}
}
+ @Override
public void textDecl(String version, String encoding, Augmentations augs)
throws XNIException {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
fDocumentHandler.textDecl(version, encoding, augs);
}
}
+ @Override
public void endGeneralEntity(String name, Augmentations augs)
throws XNIException {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING
&& fResultDepth != 0) {
fDocumentHandler.endGeneralEntity(name, augs);
}
}
+ @Override
public void characters(XMLString text, Augmentations augs)
throws XNIException {
if (getState() == STATE_NORMAL_PROCESSING) {
if (fResultDepth == 0) {
checkWhitespace(text);
*** 1090,1124 ****
--- 1112,1150 ----
fDepth--;
}
}
}
+ @Override
public void ignorableWhitespace(XMLString text, Augmentations augs)
throws XNIException {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING
&& fResultDepth != 0) {
fDocumentHandler.ignorableWhitespace(text, augs);
}
}
+ @Override
public void startCDATA(Augmentations augs) throws XNIException {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING
&& fResultDepth != 0) {
fDocumentHandler.startCDATA(augs);
}
}
+ @Override
public void endCDATA(Augmentations augs) throws XNIException {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING
&& fResultDepth != 0) {
fDocumentHandler.endCDATA(augs);
}
}
+ @Override
public void endDocument(Augmentations augs) throws XNIException {
if (isRootDocument()) {
if (!fSeenRootElement) {
reportFatalError("RootElementRequired");
}
*** 1126,1139 ****
--- 1152,1167 ----
fDocumentHandler.endDocument(augs);
}
}
}
+ @Override
public void setDocumentSource(XMLDocumentSource source) {
fDocumentSource = source;
}
+ @Override
public XMLDocumentSource getDocumentSource() {
return fDocumentSource;
}
// DTDHandler methods
*** 1141,1150 ****
--- 1169,1179 ----
// the rest we just pass on
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void attributeDecl(
String elementName,
String attributeName,
String type,
String[] enumeration,
*** 1167,1176 ****
--- 1196,1206 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#elementDecl(java.lang.String, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void elementDecl(
String name,
String contentModel,
Augmentations augmentations)
throws XNIException {
*** 1180,1238 ****
--- 1210,1274 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endAttlist(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void endAttlist(Augmentations augmentations) throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.endAttlist(augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endConditional(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void endConditional(Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.endConditional(augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endDTD(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void endDTD(Augmentations augmentations) throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.endDTD(augmentations);
}
fInDTD = false;
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endExternalSubset(com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void endExternalSubset(Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.endExternalSubset(augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#endParameterEntity(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void endParameterEntity(String name, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.endParameterEntity(name, augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#externalEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void externalEntityDecl(
String name,
XMLResourceIdentifier identifier,
Augmentations augmentations)
throws XNIException {
*** 1242,1268 ****
--- 1278,1307 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#getDTDSource()
*/
+ @Override
public XMLDTDSource getDTDSource() {
return fDTDSource;
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#ignoredCharacters(com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void ignoredCharacters(XMLString text, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.ignoredCharacters(text, augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#internalEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.XMLString, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void internalEntityDecl(
String name,
XMLString text,
XMLString nonNormalizedText,
Augmentations augmentations)
*** 1277,1286 ****
--- 1316,1326 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#notationDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void notationDecl(
String name,
XMLResourceIdentifier identifier,
Augmentations augmentations)
throws XNIException {
*** 1291,1327 ****
--- 1331,1371 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#setDTDSource(com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource)
*/
+ @Override
public void setDTDSource(XMLDTDSource source) {
fDTDSource = source;
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startAttlist(java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void startAttlist(String elementName, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.startAttlist(elementName, augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startConditional(short, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void startConditional(short type, Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.startConditional(type, augmentations);
}
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startDTD(com.sun.org.apache.xerces.internal.xni.XMLLocator, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void startDTD(XMLLocator locator, Augmentations augmentations)
throws XNIException {
fInDTD = true;
if (fDTDHandler != null) {
fDTDHandler.startDTD(locator, augmentations);
*** 1329,1338 ****
--- 1373,1383 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startExternalSubset(com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void startExternalSubset(
XMLResourceIdentifier identifier,
Augmentations augmentations)
throws XNIException {
if (fDTDHandler != null) {
*** 1341,1350 ****
--- 1386,1396 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#startParameterEntity(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void startParameterEntity(
String name,
XMLResourceIdentifier identifier,
String encoding,
Augmentations augmentations)
*** 1359,1368 ****
--- 1405,1415 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.XMLDTDHandler#unparsedEntityDecl(java.lang.String, com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier, java.lang.String, com.sun.org.apache.xerces.internal.xni.Augmentations)
*/
+ @Override
public void unparsedEntityDecl(
String name,
XMLResourceIdentifier identifier,
String notation,
Augmentations augmentations)
*** 1378,1394 ****
--- 1425,1443 ----
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#getDTDHandler()
*/
+ @Override
public XMLDTDHandler getDTDHandler() {
return fDTDHandler;
}
/* (non-Javadoc)
* @see com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource#setDTDHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDHandler)
*/
+ @Override
public void setDTDHandler(XMLDTDHandler handler) {
fDTDHandler = handler;
}
// XIncludeHandler methods
*** 1613,1627 ****
Constants.XERCES_PROPERTY_PREFIX
+ Constants.NAMESPACE_CONTEXT_PROPERTY,
fNamespaceContext);
((XPointerHandler)fXPtrProcessor).setProperty(XINCLUDE_FIXUP_BASE_URIS,
! new Boolean(fFixupBaseURIs));
((XPointerHandler)fXPtrProcessor).setProperty(
! XINCLUDE_FIXUP_LANGUAGE,
! new Boolean (fFixupLanguage));
if (fErrorReporter != null)
((XPointerHandler)fXPtrProcessor).setProperty(ERROR_REPORTER, fErrorReporter);
// ???
--- 1662,1675 ----
Constants.XERCES_PROPERTY_PREFIX
+ Constants.NAMESPACE_CONTEXT_PROPERTY,
fNamespaceContext);
((XPointerHandler)fXPtrProcessor).setProperty(XINCLUDE_FIXUP_BASE_URIS,
! fFixupBaseURIs);
((XPointerHandler)fXPtrProcessor).setProperty(
! XINCLUDE_FIXUP_LANGUAGE, fFixupLanguage);
if (fErrorReporter != null)
((XPointerHandler)fXPtrProcessor).setProperty(ERROR_REPORTER, fErrorReporter);
// ???
*** 2091,2108 ****
URI uri = new URI(base, relativeURI);
/** Check whether the scheme components are equal. */
final String baseScheme = base.getScheme();
final String literalScheme = uri.getScheme();
! if (!isEqual(baseScheme, literalScheme)) {
return relativeURI;
}
/** Check whether the authority components are equal. */
final String baseAuthority = base.getAuthority();
final String literalAuthority = uri.getAuthority();
! if (!isEqual(baseAuthority, literalAuthority)) {
return uri.getSchemeSpecificPart();
}
/**
* The scheme and authority components are equal,
--- 2139,2156 ----
URI uri = new URI(base, relativeURI);
/** Check whether the scheme components are equal. */
final String baseScheme = base.getScheme();
final String literalScheme = uri.getScheme();
! if (!Objects.equals(baseScheme, literalScheme)) {
return relativeURI;
}
/** Check whether the authority components are equal. */
final String baseAuthority = base.getAuthority();
final String literalAuthority = uri.getAuthority();
! if (!Objects.equals(baseAuthority, literalAuthority)) {
return uri.getSchemeSpecificPart();
}
/**
* The scheme and authority components are equal,
*** 2111,2121 ****
*/
final String literalPath = uri.getPath();
final String literalQuery = uri.getQueryString();
final String literalFragment = uri.getFragment();
if (literalQuery != null || literalFragment != null) {
! StringBuffer buffer = new StringBuffer();
if (literalPath != null) {
buffer.append(literalPath);
}
if (literalQuery != null) {
buffer.append('?');
--- 2159,2169 ----
*/
final String literalPath = uri.getPath();
final String literalQuery = uri.getQueryString();
final String literalFragment = uri.getFragment();
if (literalQuery != null || literalFragment != null) {
! final StringBuilder buffer = new StringBuilder();
if (literalPath != null) {
buffer.append(literalPath);
}
if (literalQuery != null) {
buffer.append('?');
*** 2622,2640 ****
public String expandedSystemId;
public Augmentations augmentations;
// equals() returns true if two Notations have the same name.
// Useful for searching Vectors for notations with the same name
public boolean equals(Object obj) {
! if (obj == null) {
! return false;
! }
! if (obj instanceof Notation) {
! Notation other = (Notation)obj;
! return name.equals(other.name);
}
! return false;
}
// from 4.5.2
// Notation items with the same [name], [system identifier],
// [public identifier], and [declaration base URI] are considered
--- 2670,2688 ----
public String expandedSystemId;
public Augmentations augmentations;
// equals() returns true if two Notations have the same name.
// Useful for searching Vectors for notations with the same name
+ @Override
public boolean equals(Object obj) {
! return obj == this || obj instanceof Notation
! && Objects.equals(name, ((Notation)obj).name);
}
!
! @Override
! public int hashCode() {
! return Objects.hashCode(name);
}
// from 4.5.2
// Notation items with the same [name], [system identifier],
// [public identifier], and [declaration base URI] are considered
*** 2643,2662 ****
// resulting from combining the system identifier and the declaration
// base URI is the same.
public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof Notation) {
Notation other = (Notation)obj;
! return name.equals(other.name)
! && isEqual(publicId, other.publicId)
! && isEqual(expandedSystemId, other.expandedSystemId);
}
return false;
}
-
- private boolean isEqual(String one, String two) {
- return (one == two || (one != null && one.equals(two)));
- }
}
// This is a storage class to hold information about the unparsed entities.
// We're not using XMLEntityDecl because we don't want to lose the augmentations.
protected static class UnparsedEntity {
--- 2691,2706 ----
// resulting from combining the system identifier and the declaration
// base URI is the same.
public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof Notation) {
Notation other = (Notation)obj;
! return Objects.equals(name, other.name)
! && Objects.equals(publicId, other.publicId)
! && Objects.equals(expandedSystemId, other.expandedSystemId);
}
return false;
}
}
// This is a storage class to hold information about the unparsed entities.
// We're not using XMLEntityDecl because we don't want to lose the augmentations.
protected static class UnparsedEntity {
*** 2668,2686 ****
public String notation;
public Augmentations augmentations;
// equals() returns true if two UnparsedEntities have the same name.
// Useful for searching Vectors for entities with the same name
public boolean equals(Object obj) {
! if (obj == null) {
! return false;
! }
! if (obj instanceof UnparsedEntity) {
! UnparsedEntity other = (UnparsedEntity)obj;
! return name.equals(other.name);
}
! return false;
}
// from 4.5.1:
// Unparsed entity items with the same [name], [system identifier],
// [public identifier], [declaration base URI], [notation name], and
--- 2712,2730 ----
public String notation;
public Augmentations augmentations;
// equals() returns true if two UnparsedEntities have the same name.
// Useful for searching Vectors for entities with the same name
+ @Override
public boolean equals(Object obj) {
! return obj == this || obj instanceof UnparsedEntity
! && Objects.equals(name, ((UnparsedEntity)obj).name);
}
!
! @Override
! public int hashCode() {
! return Objects.hashCode(name);
}
// from 4.5.1:
// Unparsed entity items with the same [name], [system identifier],
// [public identifier], [declaration base URI], [notation name], and
*** 2689,2709 ****
// means. For instance, the URI resulting from combining the system
// identifier and the declaration base URI is the same.
public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof UnparsedEntity) {
UnparsedEntity other = (UnparsedEntity)obj;
! return name.equals(other.name)
! && isEqual(publicId, other.publicId)
! && isEqual(expandedSystemId, other.expandedSystemId)
! && isEqual(notation, other.notation);
}
return false;
}
-
- private boolean isEqual(String one, String two) {
- return (one == two || (one != null && one.equals(two)));
- }
}
// The following methods are used for XML Base processing
/**
--- 2733,2749 ----
// means. For instance, the URI resulting from combining the system
// identifier and the declaration base URI is the same.
public boolean isDuplicate(Object obj) {
if (obj != null && obj instanceof UnparsedEntity) {
UnparsedEntity other = (UnparsedEntity)obj;
! return Objects.equals(name, other.name)
! && Objects.equals(publicId, other.publicId)
! && Objects.equals(expandedSystemId, other.expandedSystemId)
! && Objects.equals(notation, other.notation);
}
return false;
}
}
// The following methods are used for XML Base processing
/**
*** 2889,2909 ****
httpSource.setHTTPRequestProperty(XIncludeHandler.HTTP_ACCEPT_LANGUAGE, acceptLanguage);
}
return httpSource;
}
- private boolean isEqual(String one, String two) {
- return (one == two || (one != null && one.equals(two)));
- }
-
// which ASCII characters need to be escaped
! private static boolean gNeedEscaping[] = new boolean[128];
// the first hex character if a character needs to be escaped
! private static char gAfterEscaping1[] = new char[128];
// the second hex character if a character needs to be escaped
! private static char gAfterEscaping2[] = new char[128];
! private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
// initialize the above 3 arrays
static {
char[] escChs = {' ', '<', '>', '"', '{', '}', '|', '\\', '^', '`'};
int len = escChs.length;
--- 2929,2945 ----
httpSource.setHTTPRequestProperty(XIncludeHandler.HTTP_ACCEPT_LANGUAGE, acceptLanguage);
}
return httpSource;
}
// which ASCII characters need to be escaped
! private static final boolean gNeedEscaping[] = new boolean[128];
// the first hex character if a character needs to be escaped
! private static final char gAfterEscaping1[] = new char[128];
// the second hex character if a character needs to be escaped
! private static final char gAfterEscaping2[] = new char[128];
! private static final char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
// initialize the above 3 arrays
static {
char[] escChs = {' ', '<', '>', '"', '{', '}', '|', '\\', '^', '`'};
int len = escChs.length;
*** 2929,2939 ****
// the Unicode plane 1-14 characters #x10000-#x1FFFD ... #xE0000-#xEFFFD
//
private String escapeHref(String href) {
int len = href.length();
int ch;
! StringBuffer buffer = new StringBuffer(len*3);
// for each character in the href
int i = 0;
for (; i < len; i++) {
ch = href.charAt(i);
--- 2965,2975 ----
// the Unicode plane 1-14 characters #x10000-#x1FFFD ... #xE0000-#xEFFFD
//
private String escapeHref(String href) {
int len = href.length();
int ch;
! final StringBuilder buffer = new StringBuilder(len*3);
// for each character in the href
int i = 0;
for (; i < len; i++) {
ch = href.charAt(i);