You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by DemonShi <gi...@git.apache.org> on 2014/12/19 15:27:54 UTC

[GitHub] cxf pull request: [CXF-6163] Fixed xsd:any behaviour when used wit...

GitHub user DemonShi opened a pull request:

    https://github.com/apache/cxf/pull/46

    [CXF-6163] Fixed xsd:any behaviour when used with minOccurs=0, maxOccurs>1

    * xsd:any deserializer does not go into infinite loop when xsd:any cannot match any element and minOccurs=0
    
    Here is how generated code now looks like:
    ```javascript
        var anyObject = [];
        var matcher = new org_apache_cxf_any_ns_matcher(org_apache_cxf_any_ns_matcher.ANY, 'urn:...', [], null);
        var anyNeeded = 0;
        var anyAllowed = 9223372036854775807;
        while (anyNeeded > 0 || anyAllowed > 0) {
         var anyURI;
         var anyLocalPart;
         var anyMatched = false;
         if (curElement) {
          anyURI = cxfjsutils.getElementNamespaceURI(curElement);
          anyLocalPart = cxfjsutils.getNodeLocalName(curElement);
          var anyQName = '{' + anyURI + '}' + anyLocalPart;
          cxfjsutils.trace('any match: ' + anyQName);
          anyMatched = matcher.match(anyURI, anyLocalPart)
          cxfjsutils.trace(' --> ' + anyMatched);
         }
         if (anyMatched) {
          anyDeserializer = cxfjsutils.interfaceObject.globalElementDeserializers[anyQName];
          cxfjsutils.trace(' deserializer: ' + anyDeserializer);
          if (anyDeserializer) {
           var anyValue = anyDeserializer(cxfjsutils, curElement);
          } else {
           var anyValue = curElement.nodeValue;
          }
          anyObject.push(anyValue);
          anyNeeded--;
          anyAllowed--;
          curElement = cxfjsutils.getNextElementSibling(curElement);
         } else {
          if (anyNeeded > 0) {
           throw 'not enough ws:any elements';
          } else {
           break;
          }
         }
        }
        var anyHolder = new org_apache_cxf_any_holder(anyURI, anyLocalPart, anyValue);
        newobject.setAny(anyHolder);
    ```
    * xsd:any serializer does not throw an exception when xsd:any element is being passed as empty array and minOccurs=0
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/DemonShi/cxf cxf-6163

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/46.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #46
    
----
commit 5824a9e56386b1938667d41d27c1007943fcf098
Author: Andrii Nikitiuk <de...@gmail.com>
Date:   2014-12-19T14:17:27Z

    [CXF-6163] Fixed xsd:any behaviour when used with minOccurs=0, maxOccurs>1

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: [CXF-6163] Fixed xsd:any behaviour when used wit...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cxf/pull/46


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---