--- old/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java 2013-04-04 15:27:25.436613051 +0200 +++ new/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java 2013-04-04 15:27:25.380613050 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,7 @@ import com.sun.xml.internal.bind.v2.ClassFactory; import com.sun.xml.internal.bind.v2.WellKnownNamespace; import com.sun.xml.internal.bind.v2.model.core.ID; +import com.sun.xml.internal.bind.v2.model.nav.Navigator; import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty; @@ -190,10 +191,11 @@ Property[] props = bi.properties; if (props == null) break; for (Property superProperty : props) { - if (superProperty == null) break; - String spName = superProperty.getFieldName(); - if ((spName != null) && (spName.equals(p.getFieldName()))) { - superProperty.setHiddenByOverride(true); + if (superProperty != null) { + String spName = superProperty.getFieldName(); + if ((spName != null) && (spName.equals(p.getFieldName()))) { + superProperty.setHiddenByOverride(true); + } } } } @@ -339,8 +341,15 @@ if (retainPropertyInfo) { target.currentProperty.set(p); } - if (!(p.isHiddenByOverride() && !bean.getClass().equals(jaxbType))) { + boolean isThereAnOverridingProperty = p.isHiddenByOverride(); + if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) { p.serializeBody(bean, target, null); + } else if (isThereAnOverridingProperty) { + // 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 + Class beanClass = bean.getClass(); + if (Navigator.REFLECTION.getDeclaredField(beanClass, p.getFieldName()) == null) { + p.serializeBody(bean, target, null); + } } } } catch (AccessorException e) {