openjdk-1.8.0/fixing-a-bug-in-the-processing-of-default-attributes.patch
2023-08-01 15:30:06 +08:00

39 lines
1.8 KiB
Diff

From 93a6617cd05d494c7a761c5565e412f03aefb569 Mon Sep 17 00:00:00 2001
Date: Thu, 27 Jul 2023 12:45:54 +0800
Subject: [PATCH] [Huawei]Fixing a bug in the processing of default attributes
---
.../apache/xerces/internal/impl/xs/XMLSchemaValidator.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
index 020e35cd4..7a2b8efb5 100644
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
@@ -2943,9 +2943,11 @@ public class XMLSchemaValidator
attName =
new QName(null, currDecl.fName, currDecl.fName, currDecl.fTargetNamespace);
String normalized = (defaultValue != null) ? defaultValue.stringValue() : "";
- int attrIndex = attributes.addAttribute(attName, "CDATA", normalized);
+ int attrIndex;
if (attributes instanceof XMLAttributesImpl) {
XMLAttributesImpl attrs = (XMLAttributesImpl) attributes;
+ attrIndex = attrs.getLength();
+ attrs.addAttributeNS(attName, "CDATA", normalized);
boolean schemaId =
defaultValue != null
&& defaultValue.memberType != null
@@ -2953,6 +2955,9 @@ public class XMLSchemaValidator
: currDecl.fType.isIDType();
attrs.setSchemaId(attrIndex, schemaId);
}
+ else {
+ attrIndex = attributes.addAttribute(attName, "CDATA", normalized);
+ }
if (fAugPSVI) {
--
2.19.1