Merge

Tue, 29 Mar 2016 23:01:47 +0100

author
robm
date
Tue, 29 Mar 2016 23:01:47 +0100
changeset 1102
43833fcf4701
parent 1099
0a82e8a2c226
parent 1101
bd88174c3095
child 1103
face9bd6bac2
child 1166
b949dc73142a

Merge

     1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Tue Mar 29 13:26:58 2016 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Tue Mar 29 23:01:47 2016 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -100,10 +100,15 @@
    1.11       */
    1.12      private static QName resolveSimpleTypeName(XSType declType) {
    1.13          QName name = BGMBuilder.getName(declType);
    1.14 -        if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI()))
    1.15 -            return resolveSimpleTypeName(declType.getBaseType());
    1.16 -        else
    1.17 -            return name;
    1.18 +        QName result = null;
    1.19 +        if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI())) {
    1.20 +            result = resolveSimpleTypeName(declType.getBaseType());
    1.21 +        } else {
    1.22 +            if ( !"anySimpleType".equals(declType.getName()) ) {
    1.23 +                result = name;
    1.24 +            }
    1.25 +        }
    1.26 +        return result;
    1.27      }
    1.28  
    1.29      public CTypeRef(CNonElement type, QName elementName, QName typeName, boolean nillable, XmlString defaultValue) {
     2.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java	Tue Mar 29 13:26:58 2016 -0700
     2.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java	Tue Mar 29 23:01:47 2016 +0100
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -110,6 +110,7 @@
    2.11  import com.sun.xml.internal.txw2.output.ResultFactory;
    2.12  import com.sun.xml.internal.txw2.output.XmlSerializer;
    2.13  import java.util.Collection;
    2.14 +import java.util.HashSet;
    2.15  import org.xml.sax.SAXParseException;
    2.16  
    2.17  /**
    2.18 @@ -436,7 +437,7 @@
    2.19  
    2.20          if(logger.isLoggable(Level.FINE)) {
    2.21              // debug logging to see what's going on.
    2.22 -            logger.log(Level.FINE,"Wrigin XML Schema for "+toString(),new StackRecorder());
    2.23 +            logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder());
    2.24          }
    2.25  
    2.26          // make it fool-proof
    2.27 @@ -465,6 +466,8 @@
    2.28                      systemIds.put(n,output.getSystemId());
    2.29                  }
    2.30              }
    2.31 +            //Clear the namespace specific set with already written classes
    2.32 +            n.resetWritten();
    2.33          }
    2.34  
    2.35          // then write'em all
    2.36 @@ -542,6 +545,11 @@
    2.37           */
    2.38          private boolean useMimeNs;
    2.39  
    2.40 +        /**
    2.41 +         * Container for already processed classes
    2.42 +         */
    2.43 +        private final Set<ClassInfo> written = new HashSet<ClassInfo>();
    2.44 +
    2.45          public Namespace(String uri) {
    2.46              this.uri = uri;
    2.47              assert !XmlSchemaGenerator.this.namespaces.containsKey(uri);
    2.48 @@ -549,6 +557,13 @@
    2.49          }
    2.50  
    2.51          /**
    2.52 +         * Clear out the set of already processed classes for this namespace
    2.53 +         */
    2.54 +        void resetWritten() {
    2.55 +            written.clear();
    2.56 +        }
    2.57 +
    2.58 +        /**
    2.59           * Process the given PropertyInfo looking for references to namespaces that
    2.60           * are foreign to the given namespace.  Any foreign namespace references
    2.61           * found are added to the given namespaces dependency list and an &lt;import>
    2.62 @@ -853,6 +868,10 @@
    2.63           * @param parent the writer of the parent element into which the type will be defined
    2.64           */
    2.65          private void writeClass(ClassInfo<T,C> c, TypeHost parent) {
    2.66 +            if (written.contains(c)) { // to avoid cycles let's check if we haven't already processed the class
    2.67 +                return;
    2.68 +            }
    2.69 +            written.add(c);
    2.70              // special handling for value properties
    2.71              if (containsValueProp(c)) {
    2.72                  if (c.getProperties().size() == 1) {

mercurial