cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: [CXF-5800] SchemaValidation of RPC/Lit endpoints fails if data has attributes
Date Thu, 23 Mar 2017 17:13:51 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7d26a5962 -> 753730777


[CXF-5800] SchemaValidation of RPC/Lit endpoints fails if data has attributes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/75373077
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/75373077
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/75373077

Branch: refs/heads/master
Commit: 753730777fe877b7fad12e87f0d99a00fba25917
Parents: 7d26a59
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Mar 23 12:42:23 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 23 13:13:47 2017 -0400

----------------------------------------------------------------------
 .../org/apache/cxf/jaxb/JAXBEncoderDecoder.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/75373077/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
index 2c4483a..9283ea1 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
@@ -102,6 +102,7 @@ import org.apache.ws.commons.schema.constants.Constants;
 public final class JAXBEncoderDecoder {
     private static final class AddXSITypeStreamReader extends StreamReaderDelegate {
         private boolean first = true;
+        private int offset = 1;
         private final QName typeQName;
 
         private AddXSITypeStreamReader(XMLStreamReader reader, QName typeQName) {
@@ -110,42 +111,42 @@ public final class JAXBEncoderDecoder {
         }
 
         public int getAttributeCount() {
-            return super.getAttributeCount() + (first ? 1 : 0);
+            return super.getAttributeCount() + offset;
         }
 
         public String getAttributeLocalName(int index) {
             if (first && index == 0) {
                 return "type";
             }
-            return super.getAttributeLocalName(index - 1);
+            return super.getAttributeLocalName(index - offset);
         }
 
         public QName getAttributeName(int index) {
             if (first && index == 0) {
                 return new QName(Constants.URI_2001_SCHEMA_XSI, "type");
             }
-            return super.getAttributeName(index - 1);
+            return super.getAttributeName(index - offset);
         }
 
         public String getAttributeNamespace(int index) {
             if (first && index == 0) {
                 return Constants.URI_2001_SCHEMA_XSI;
             }
-            return super.getAttributeNamespace(index - 1);
+            return super.getAttributeNamespace(index - offset);
         }
 
         public String getAttributePrefix(int index) {
             if (first && index == 0) {
                 return "xsi";
             }
-            return super.getAttributePrefix(index - 1);
+            return super.getAttributePrefix(index - offset);
         }
 
         public String getAttributeType(int index) {
             if (first && index == 0) {
                 return "#TEXT";
             }
-            return super.getAttributeType(index - 1);
+            return super.getAttributeType(index - offset);
         }
 
         public String getAttributeValue(int index) {
@@ -156,11 +157,12 @@ public final class JAXBEncoderDecoder {
                 }
                 return pfx + ":" + typeQName.getLocalPart();
             }
-            return super.getAttributeValue(index);
+            return super.getAttributeValue(index - offset);
         }
 
         public int next()  throws XMLStreamException {
             first = false;
+            offset = 0;
             return super.next();
         }
 


Mime
View raw message