8145039: JAXB marshaller fails with ClassCastException on classes generated by xjc

Thu, 24 Mar 2016 01:15:32 +0300

author
aefimov
date
Thu, 24 Mar 2016 01:15:32 +0300
changeset 1100
391a42f11d6e
parent 1090
73446762f6be
child 1101
bd88174c3095

8145039: JAXB marshaller fails with ClassCastException on classes generated by xjc
Reviewed-by: lancea

src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CTypeRef.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Mon Feb 01 16:35:31 2016 -0800
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CTypeRef.java	Thu Mar 24 01:15:32 2016 +0300
     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) {

mercurial