Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C7E282C5 for ; Thu, 1 Sep 2011 16:36:31 +0000 (UTC) Received: (qmail 2287 invoked by uid 500); 1 Sep 2011 16:36:30 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 1878 invoked by uid 500); 1 Sep 2011 16:36:30 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 1769 invoked by uid 99); 1 Sep 2011 16:36:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 16:36:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 16:36:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 82A3C2388A9B for ; Thu, 1 Sep 2011 16:36:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1164145 - in /cxf/branches/2.4.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Date: Thu, 01 Sep 2011 16:36:05 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110901163605.82A3C2388A9B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Thu Sep 1 16:36:05 2011 New Revision: 1164145 URL: http://svn.apache.org/viewvc?rev=1164145&view=rev Log: Merged revisions 1164141 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1164141 | dkulp | 2011-09-01 12:33:15 -0400 (Thu, 01 Sep 2011) | 1 line [CXF-2779] Us getDeclaredField so we can get the private fields ........ Modified: cxf/branches/2.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=1164145&r1=1164144&r2=1164145&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original) +++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Thu Sep 1 16:36:05 2011 @@ -49,6 +49,7 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.adapters.HexBinaryAdapter; import javax.xml.bind.attachment.AttachmentMarshaller; import javax.xml.bind.attachment.AttachmentUnmarshaller; @@ -356,16 +357,18 @@ public final class JAXBEncoderDecoder { } else { LOG.warning("Schema associated with " + namespace + " is null"); } - for (Field f : cls.getDeclaredFields()) { if (JAXBContextInitializer.isFieldAccepted(f, accessType)) { - QName fname = new QName(namespace, f.getName()); - f.setAccessible(true); - if (JAXBSchemaInitializer.isArray(f.getGenericType())) { - writeArrayObject(marshaller, writer, fname, f.get(elValue)); - } else { - writeObject(marshaller, writer, new JAXBElement(fname, String.class, - f.get(elValue))); + XmlAttribute at = f.getAnnotation(XmlAttribute.class); + if (at == null) { + QName fname = new QName(namespace, f.getName()); + f.setAccessible(true); + if (JAXBSchemaInitializer.isArray(f.getGenericType())) { + writeArrayObject(marshaller, writer, fname, f.get(elValue)); + } else { + writeObject(marshaller, writer, new JAXBElement(fname, String.class, + f.get(elValue))); + } } } } @@ -462,7 +465,12 @@ public final class JAXBEncoderDecoder { while (reader.getEventType() == XMLStreamReader.START_ELEMENT) { QName q = reader.getName(); try { - Field f = cls.getField(q.getLocalPart()); + Field f = null; + try { + f = cls.getDeclaredField(q.getLocalPart()); + } catch (NoSuchFieldException nsf) { + f = cls.getField(q.getLocalPart()); + } Type type = f.getGenericType(); if (JAXBContextInitializer.isFieldAccepted(f, accessType)) { f.setAccessible(true);