cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-5322) misleading warning for @XmlType without 'propOrder' element
Date Tue, 08 Oct 2013 19:10:43 GMT

     [ https://issues.apache.org/jira/browse/CXF-5322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Kulp resolved CXF-5322.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6.11
                   2.7.8
         Assignee: Daniel Kulp

> misleading warning for @XmlType without 'propOrder' element
> -----------------------------------------------------------
>
>                 Key: CXF-5322
>                 URL: https://issues.apache.org/jira/browse/CXF-5322
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAXB Databinding
>    Affects Versions: 2.7.6
>         Environment: JBoss EAP 6.1.1
> JDK 6u45
>            Reporter: lars geidel
>            Assignee: Daniel Kulp
>            Priority: Minor
>              Labels: patch
>             Fix For: 2.7.8, 2.6.11
>
>
> When the @XmlType annotation is used without specifying the propOrder element the following
warning is logged:
> WARNING [org.apache.cxf.jaxb.JAXBSchemaInitializer] propOrder in @XmlType doesn't define
all schema elements :[]
> This warning is misleading and should not appear in that case.
> Relevant code of org.apache.cxf.jaxb.JAXBSchemaInitializer:
> {code:java}
> XmlType xmlTypeAnno = cls.getAnnotation(XmlType.class);
> String[] propertyOrder = null;
> [...]
> if (xmlTypeAnno != null &&  xmlTypeAnno.propOrder().length > 0) {
>     propertyOrder = xmlTypeAnno.propOrder();
> }
> [...]
> if (propertyOrder != null && propertyOrder.length == seq.getItems().size()) {
>     sortItems(seq, propertyOrder);
> } else if (propertyOrder != null && propertyOrder.length != seq.getItems().size())
{
>     LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements
:" 
>         + Arrays.toString(propertyOrder));
> }
> {code}
> If no propOrder element is defined then xmlTypeAnno.propOrder() defaults to {""} (see
http://docs.oracle.com/javaee/7/api/javax/xml/bind/annotation/XmlType.html#propOrder()), so
xmlTypeAnno.propOrder().length is 1. Since this is not necessarily equals seq.getItems().size()
the mentioned warning is logged.
> Possible patch: the if-elseif-block could be replaced by
> {code:java}
> if (propertyOrder != null) {
>     if (propertyOrder.length == seq.getItems().size())
>     {
>         sortItems(seq, propertyOrder);
>     } else if (propertyOrder.length > 1 || !propertyOrder[0].isEmpty()) {
>         LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements
:" 
>             + Arrays.toString(propertyOrder));
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message