src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 450
b0c2840e2513
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java	Tue Apr 09 14:51:13 2013 +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, 2012, 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 @@ -48,6 +48,7 @@
    1.11  import com.sun.xml.internal.bind.v2.ClassFactory;
    1.12  import com.sun.xml.internal.bind.v2.WellKnownNamespace;
    1.13  import com.sun.xml.internal.bind.v2.model.core.ID;
    1.14 +import com.sun.xml.internal.bind.v2.model.nav.Navigator;
    1.15  import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo;
    1.16  import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
    1.17  import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty;
    1.18 @@ -190,10 +191,11 @@
    1.19              Property[] props = bi.properties;
    1.20              if (props == null) break;
    1.21              for (Property superProperty : props) {
    1.22 -                if (superProperty == null) break;
    1.23 -                String spName = superProperty.getFieldName();
    1.24 -                if ((spName != null) && (spName.equals(p.getFieldName()))) {
    1.25 -                    superProperty.setHiddenByOverride(true);
    1.26 +                if (superProperty != null) {
    1.27 +                    String spName = superProperty.getFieldName();
    1.28 +                    if ((spName != null) && (spName.equals(p.getFieldName()))) {
    1.29 +                        superProperty.setHiddenByOverride(true);
    1.30 +                    }
    1.31                  }
    1.32              }
    1.33          }
    1.34 @@ -339,8 +341,15 @@
    1.35                  if (retainPropertyInfo) {
    1.36                      target.currentProperty.set(p);
    1.37                  }
    1.38 -                if (!(p.isHiddenByOverride() && !bean.getClass().equals(jaxbType))) {
    1.39 +                boolean isThereAnOverridingProperty = p.isHiddenByOverride();
    1.40 +                if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
    1.41                      p.serializeBody(bean, target, null);
    1.42 +                } else if (isThereAnOverridingProperty) {
    1.43 +                    // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
    1.44 +                    Class beanClass = bean.getClass();
    1.45 +                    if (Navigator.REFLECTION.getDeclaredField(beanClass, p.getFieldName()) == null) {
    1.46 +                        p.serializeBody(bean, target, null);
    1.47 +                    }
    1.48                  }
    1.49              }
    1.50          } catch (AccessorException e) {

mercurial