Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 222584 Details for
Bug 383424
Property of an @XmlTransient type gets mapped and marshalled (as a String)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed changes
bug383424_updated.patch (text/plain), 48.08 KB, created by
Denise Smith
on 2012-10-19 11:16:41 EDT
(
hide
)
Description:
Proposed changes
Filename:
MIME Type:
Creator:
Denise Smith
Created:
2012-10-19 11:16:41 EDT
Size:
48.08 KB
patch
obsolete
>diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java >index df3b234..c0ab40f 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeCollectionMappingNodeValue.java >@@ -306,7 +306,10 @@ public class XMLCompositeCollectionMappingNodeValue extends XMLRelationshipMappi > marshalRecord.endElement(xPathFragment, namespaceResolver); > objectBuilder.removeExtraNamespacesFromNamespaceResolver(marshalRecord, extraNamespaces, session); > >- } else { >+ } else { >+ if(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS.equals(xmlCompositeCollectionMapping.getReferenceClassName())){ >+ throw XMLMarshalException.descriptorNotFoundInProject(value.getClass().getName()); >+ } > xPathNode.startElement(marshalRecord, xPathFragment, object, session, namespaceResolver, null, value); > > QName schemaType = ((XMLField) xmlCompositeCollectionMapping.getField()).getSchemaTypeForValue(value, session); >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java >index c2805f8..b9a6af6 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLCompositeObjectMappingNodeValue.java >@@ -49,6 +49,7 @@ import org.w3c.dom.Element; > import org.w3c.dom.NamedNodeMap; > import org.w3c.dom.Node; > import org.w3c.dom.NodeList; >+import org.w3c.dom.Text; > import org.xml.sax.Attributes; > import org.xml.sax.SAXException; > >@@ -181,13 +182,18 @@ public class XMLCompositeObjectMappingNodeValue extends XMLRelationshipMappingNo > if (((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT)) && objectValue instanceof Node) { > if(isSelfFragment){ > NodeList children = ((org.w3c.dom.Element) objectValue).getChildNodes(); >- for(int i =0, size=children.getLength(); i<size ; i++) { >- Node next = children.item(i); >- if(next.getNodeType() == Node.ELEMENT_NODE){ >- marshalRecord.node(next, marshalRecord.getNamespaceResolver()); >- return true; >+ int childrenLength = children.getLength(); >+ for(int i =0; i<childrenLength ; i++) { >+ Node next = children.item(i); >+ if(next.getNodeType() == Node.ELEMENT_NODE){ >+ marshalRecord.node(next, marshalRecord.getNamespaceResolver()); >+ return true; >+ }else if(next.getNodeType() == Node.TEXT_NODE){ >+ marshalRecord.characters(((Text)next).getNodeValue()); >+ return true; >+ } > } >- } >+ return false; > }else{ > marshalRecord.node((Node) objectValue, marshalRecord.getNamespaceResolver()); > return true; >@@ -227,7 +233,11 @@ public class XMLCompositeObjectMappingNodeValue extends XMLRelationshipMappingNo > marshalRecord.endElement(xPathFragment, namespaceResolver); > } > objectBuilder.removeExtraNamespacesFromNamespaceResolver(marshalRecord, extraNamespaces, session); >- } else { >+ } else { >+ if(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS.equals(xmlCompositeObjectMapping.getReferenceClassName())){ >+ throw XMLMarshalException.descriptorNotFoundInProject(objectValue.getClass().getName()); >+ } >+ > if (!(isSelfFragment || xPathFragment.nameIsText())) { > xPathNode.startElement(marshalRecord, xPathFragment, object, session, namespaceResolver, null, objectValue); > } >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/XMLConstants.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/XMLConstants.java >index b79a3af..4f03705 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/XMLConstants.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/XMLConstants.java >@@ -106,6 +106,7 @@ public class XMLConstants { > public static final String ANY_TYPE = "anyType"; > public static final String ANY_URI = "anyURI"; > public static final String SWA_REF = "swaRef"; >+ public static final String UNKNOWN_OR_TRANSIENT_CLASS = "UNKNOWN_OR_TRANSIENT_CLASS"; > > // Schema Type QNames > public static final QName ANY_QNAME = new QName(SCHEMA_URL, ANY); >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeCollectionMapping.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeCollectionMapping.java >index 7a7d379..4113d94 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeCollectionMapping.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeCollectionMapping.java >@@ -289,6 +289,13 @@ public class XMLCompositeCollectionMapping extends AbstractCompositeCollectionMa > return true; > } > >+ >+ public void convertClassNamesToClasses(ClassLoader classLoader){ >+ if(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS.equals(referenceClassName)){ >+ return; >+ } >+ super.convertClassNamesToClasses(classLoader); >+ } > /** > * INTERNAL: > * The mapping is initialized with the given session. This mapping is fully initialized >@@ -297,7 +304,9 @@ public class XMLCompositeCollectionMapping extends AbstractCompositeCollectionMa > public void initialize(AbstractSession session) throws DescriptorException { > //modified so that reference class on composite mappings is no longer mandatory > if ((getReferenceClass() == null) && (getReferenceClassName() != null)) { >- setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName())); >+ if(!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)){ >+ setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName())); >+ } > } > if (getReferenceClass() != null) { > super.initialize(session); >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeObjectMapping.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeObjectMapping.java >index d8f72b8..27e9f87 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeObjectMapping.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/mappings/XMLCompositeObjectMapping.java >@@ -324,6 +324,15 @@ public class XMLCompositeObjectMapping extends AbstractCompositeObjectMapping im > return this.inverseReferenceMapping.getSetMethodName(); > } > >+ >+ public void convertClassNamesToClasses(ClassLoader classLoader){ >+ if(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS.equals(referenceClassName)){ >+ return; >+ } >+ super.convertClassNamesToClasses(classLoader); >+ } >+ >+ > /** > * INTERNAL: > * The mapping is initialized with the given session. This mapping is fully initialized >@@ -332,7 +341,9 @@ public class XMLCompositeObjectMapping extends AbstractCompositeObjectMapping im > public void initialize(AbstractSession session) throws DescriptorException { > //modified so that reference class on composite mappings is no longer mandatory > if ((getReferenceClass() == null) && (getReferenceClassName() != null)) { >- setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName())); >+ if(!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)){ >+ setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName())); >+ } > } > if (getReferenceClass() != null) { > super.initialize(session); >diff --git a/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.json b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.json >new file mode 100644 >index 0000000..bedc492 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.json >@@ -0,0 +1 @@ >+{"root":{}} >\ No newline at end of file >diff --git a/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.xml b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.xml >new file mode 100644 >index 0000000..f5e420f >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.xml >@@ -0,0 +1 @@ >+<ns0:root xmlns:ns0="AGroupDef/annotation"/> >\ No newline at end of file >diff --git a/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.json b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.json >new file mode 100644 >index 0000000..7f35fb1 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.json >@@ -0,0 +1 @@ >+{"doc":"thetext"} >\ No newline at end of file >diff --git a/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.xml b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.xml >new file mode 100644 >index 0000000..4a9b649 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.xml >@@ -0,0 +1 @@ >+<doc>thetext</doc> >\ No newline at end of file >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/JAXBTestSuite2.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/JAXBTestSuite2.java >index 66b2063..dd0968a 100644 >--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/JAXBTestSuite2.java >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/JAXBTestSuite2.java >@@ -26,6 +26,8 @@ import org.eclipse.persistence.testing.jaxb.inheritance.ns.JAXBInheritanceSubTyp > import org.eclipse.persistence.testing.jaxb.inheritance.ns.JAXBInheritanceSubTypeTestCases; > import org.eclipse.persistence.testing.jaxb.inheritance.simple.XmlValueInheritanceTestCases; > import org.eclipse.persistence.testing.jaxb.jaxbelement.complex.JAXBElementComplexTestCases; >+import org.eclipse.persistence.testing.jaxb.jaxbelement.dom.ElementTestCases; >+import org.eclipse.persistence.testing.jaxb.jaxbelement.dom.TextNodeTestCases; > import org.eclipse.persistence.testing.jaxb.jaxbelement.nested.JAXBElementNestedTestCases; > import org.eclipse.persistence.testing.jaxb.jaxbelement.nil.JAXBElementNilTestCases; > import org.eclipse.persistence.testing.jaxb.jaxbelement.simple.JAXBElementBase64TestCases; >@@ -80,6 +82,8 @@ public class JAXBTestSuite2 extends TestCase { > suite.addTestSuite(org.eclipse.persistence.testing.jaxb.xmlenum.XmlValueAnnotationWithEnumTestCases.class); > suite.addTestSuite(org.eclipse.persistence.testing.jaxb.xmlenum.XmlEnumChoiceObjectTestCases.class); > suite.addTestSuite(org.eclipse.persistence.testing.jaxb.xmlenum.XmlEnumChoiceCollectionTestCases.class); >+ suite.addTestSuite(TextNodeTestCases.class); >+ suite.addTestSuite(ElementTestCases.class); > suite.addTestSuite(JAXBElementSimpleTestCases.class); > suite.addTestSuite(JAXBElementNestedTestCases.class); > suite.addTestSuite(JAXBElementComplexTestCases.class); >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransient.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransient.java >new file mode 100644 >index 0000000..537cc2a >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransient.java >@@ -0,0 +1,21 @@ >+/******************************************************************************* >+ * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Denise Smith - October 18, 2012 >+ ******************************************************************************/ >+package org.eclipse.persistence.testing.jaxb.annotations.xmltransient; >+ >+import java.util.List; >+ >+public class ObjectWithTransient { >+ public String testString; >+ public TransientClass transientThing; >+ public List<TransientClass> transientThings; >+} >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientListTestCases.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientListTestCases.java >new file mode 100644 >index 0000000..3e7f182 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientListTestCases.java >@@ -0,0 +1,195 @@ >+/******************************************************************************* >+ * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Denise Smith - October 18, 2012 >+ ******************************************************************************/ >+package org.eclipse.persistence.testing.jaxb.annotations.xmltransient; >+ >+import java.util.ArrayList; >+ >+import javax.xml.bind.MarshalException; >+ >+import org.eclipse.persistence.exceptions.XMLMarshalException; >+import org.eclipse.persistence.testing.jaxb.JAXBWithJSONTestCases; >+ >+public class ObjectWithTransientListTestCases extends JAXBWithJSONTestCases{ >+ >+ public ObjectWithTransientListTestCases(String name) throws Exception { >+ super(name); >+ setClasses(new Class[] { ObjectWithTransient.class }); >+ } >+ >+ @Override >+ protected Object getControlObject() { >+ ObjectWithTransient obj = new ObjectWithTransient(); >+ obj.testString = "theTest"; >+ TransientClass transientThing = new TransientClass(); >+ obj.transientThings = new ArrayList<TransientClass>(); >+ obj.transientThings.add(transientThing); >+ >+ return obj; >+ } >+ >+ public boolean isUnmarshalTest(){ >+ return false; >+ } >+ >+ >+ public void testJSONMarshalToOutputStream() throws Exception{ >+ try{ >+ super.testJSONMarshalToOutputStream(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ }catch (Exception e) { >+e.printStackTrace(); >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToOutputStream_FORMATTED() throws Exception{ >+ try{ >+ super.testJSONMarshalToOutputStream_FORMATTED(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToStringWriter() throws Exception{ >+ try{ >+ super.testJSONMarshalToStringWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToStringWriter_FORMATTED() throws Exception{ >+ try{ >+ super.testJSONMarshalToStringWriter_FORMATTED(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToContentHandler() throws Exception{ >+ try{ >+ super.testObjectToContentHandler(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToOutputStream() throws Exception{ >+ try{ >+ super.testObjectToOutputStream(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToOutputStreamASCIIEncoding() throws Exception{ >+ try{ >+ super.testObjectToOutputStreamASCIIEncoding(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLDocument() throws Exception{ >+ try{ >+ super.testObjectToXMLDocument(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLEventWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLEventWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ public void testObjectToXMLStreamWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLStreamWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ public void testObjectToXMLStreamWriterRecord() throws Exception{ >+ try{ >+ super.testObjectToXMLStreamWriterRecord(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLStringWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLStringWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+} >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientTestCases.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientTestCases.java >new file mode 100644 >index 0000000..9be7d3e >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/ObjectWithTransientTestCases.java >@@ -0,0 +1,189 @@ >+/******************************************************************************* >+ * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Denise Smith - October 18, 2012 >+ ******************************************************************************/ >+package org.eclipse.persistence.testing.jaxb.annotations.xmltransient; >+ >+import java.util.ArrayList; >+ >+import javax.xml.bind.MarshalException; >+ >+import org.eclipse.persistence.exceptions.XMLMarshalException; >+import org.eclipse.persistence.testing.jaxb.JAXBWithJSONTestCases; >+ >+public class ObjectWithTransientTestCases extends JAXBWithJSONTestCases{ >+ >+ public ObjectWithTransientTestCases(String name) throws Exception { >+ super(name); >+ setClasses(new Class[] { ObjectWithTransient.class }); >+ } >+ >+ @Override >+ protected Object getControlObject() { >+ ObjectWithTransient obj = new ObjectWithTransient(); >+ obj.testString = "theTest"; >+ obj.transientThing = new TransientClass(); >+ return obj; >+ } >+ >+ public boolean isUnmarshalTest(){ >+ return false; >+ } >+ >+ public void testJSONMarshalToOutputStream() throws Exception{ >+ try{ >+ super.testJSONMarshalToOutputStream(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToOutputStream_FORMATTED() throws Exception{ >+ try{ >+ super.testJSONMarshalToOutputStream_FORMATTED(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToStringWriter() throws Exception{ >+ try{ >+ super.testJSONMarshalToStringWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testJSONMarshalToStringWriter_FORMATTED() throws Exception{ >+ try{ >+ super.testJSONMarshalToStringWriter_FORMATTED(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToContentHandler() throws Exception{ >+ try{ >+ super.testObjectToContentHandler(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToOutputStream() throws Exception{ >+ try{ >+ super.testObjectToOutputStream(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToOutputStreamASCIIEncoding() throws Exception{ >+ try{ >+ super.testObjectToOutputStreamASCIIEncoding(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ Throwable actualException = ((XMLMarshalException)linkedException).getCause(); >+ assertTrue(actualException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)actualException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLDocument() throws Exception{ >+ try{ >+ super.testObjectToXMLDocument(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLEventWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLEventWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ public void testObjectToXMLStreamWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLStreamWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ public void testObjectToXMLStreamWriterRecord() throws Exception{ >+ try{ >+ super.testObjectToXMLStreamWriterRecord(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+ >+ public void testObjectToXMLStringWriter() throws Exception{ >+ try{ >+ super.testObjectToXMLStringWriter(); >+ }catch(MarshalException e){ >+ Throwable linkedException = e.getLinkedException(); >+ assertTrue(linkedException instanceof XMLMarshalException); >+ assertEquals("Wrong XMLMarshalExcpetion was thrown",XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT ,((XMLMarshalException)linkedException).getErrorCode()); >+ return; >+ } >+ fail("An exception should have been thrown"); >+ } >+} >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/XmlTransientTestSuite.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/XmlTransientTestSuite.java >index ced8368..67e3788 100644 >--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/XmlTransientTestSuite.java >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmltransient/XmlTransientTestSuite.java >@@ -26,6 +26,8 @@ public class XmlTransientTestSuite extends TestCase { > suite.addTestSuite(PropOrderTestCases.class); > suite.addTestSuite(TransientClassTestCases.class); > suite.addTestSuite(PropertyOverrideTestCases.class); >+ suite.addTestSuite(ObjectWithTransientTestCases.class); >+ suite.addTestSuite(ObjectWithTransientListTestCases.class); > return suite; > } > >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ElementTestCases.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ElementTestCases.java >new file mode 100644 >index 0000000..f422b60 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ElementTestCases.java >@@ -0,0 +1,41 @@ >+package org.eclipse.persistence.testing.jaxb.jaxbelement.dom; >+ >+import javax.xml.bind.JAXBElement; >+import javax.xml.parsers.DocumentBuilderFactory; >+ >+import org.eclipse.persistence.testing.jaxb.JAXBWithJSONTestCases; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+ >+public class ElementTestCases extends JAXBWithJSONTestCases{ >+ >+ private final static String XML_RESOURCE = "org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.xml"; >+ private final static String JSON_RESOURCE = "org/eclipse/persistence/testing/jaxb/jaxbelement/dom/element.json"; >+ >+ >+ public ElementTestCases(String name) throws Exception { >+ super(name); >+ setContextPath("org.eclipse.persistence.testing.jaxb.jaxbelement.dom"); >+ setControlDocument(XML_RESOURCE); >+ setControlJSON(JSON_RESOURCE); >+ } >+ >+ @Override >+ protected Object getControlObject() { >+ ObjectFactory factory = new ObjectFactory(); >+ Document doc; >+ try { >+ doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); >+ Element elm = doc.createElementNS("AGroupDef/annotation", "rootchild"); >+ elm.setTextContent(""); >+ JAXBElement obj = factory.createRoot(elm); >+ return obj; >+ } catch (Exception e) { >+ e.printStackTrace(); >+ fail("An exception was thrown."); >+ return null; >+ } >+ } >+ >+ >+} >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ObjectFactory.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ObjectFactory.java >new file mode 100644 >index 0000000..930a086 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/ObjectFactory.java >@@ -0,0 +1,62 @@ >+// >+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 >+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> >+// Any modifications to this file will be lost upon recompilation of the source schema. >+// Generated on: 2012.10.18 at 09:37:32 AM EDT >+// >+ >+ >+package org.eclipse.persistence.testing.jaxb.jaxbelement.dom; >+ >+import javax.xml.bind.JAXBElement; >+import javax.xml.bind.annotation.XmlElementDecl; >+import javax.xml.bind.annotation.XmlRegistry; >+import javax.xml.namespace.QName; >+ >+ >+/** >+ * This object contains factory methods for each >+ * Java content interface and Java element interface >+ * generated in the generated package. >+ * <p>An ObjectFactory allows you to programatically >+ * construct new instances of the Java representation >+ * for XML content. The Java representation of XML >+ * content can consist of schema derived interfaces >+ * and classes representing the binding of schema >+ * type definitions, element declarations and model >+ * groups. Factory methods for each of these are >+ * provided in this class. >+ * >+ */ >+@XmlRegistry >+public class ObjectFactory { >+ >+ private final static QName _Doc_QNAME = new QName("", "doc"); >+ private final static QName _Root_QNAME = new QName("AGroupDef/annotation", "root"); >+ >+ /** >+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated >+ * >+ */ >+ public ObjectFactory() { >+ } >+ >+ /** >+ * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} >+ * >+ */ >+ @XmlElementDecl(namespace = "", name = "doc") >+ public JAXBElement<Object> createDoc(Object value) { >+ return new JAXBElement<Object>(_Doc_QNAME, Object.class, null, value); >+ } >+ >+ /** >+ * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} >+ * >+ */ >+ @XmlElementDecl(namespace = "AGroupDef/annotation", name = "root") >+ public JAXBElement<Object> createRoot(Object value) { >+ return new JAXBElement<Object>(_Root_QNAME, Object.class, null, value); >+ } >+ >+} >diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/TextNodeTestCases.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/TextNodeTestCases.java >new file mode 100644 >index 0000000..043c799 >--- /dev/null >+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/jaxbelement/dom/TextNodeTestCases.java >@@ -0,0 +1,43 @@ >+package org.eclipse.persistence.testing.jaxb.jaxbelement.dom; >+ >+import javax.xml.bind.JAXBElement; >+import javax.xml.parsers.DocumentBuilderFactory; >+import javax.xml.parsers.ParserConfigurationException; >+ >+import org.eclipse.persistence.testing.jaxb.JAXBWithJSONTestCases; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+ >+public class TextNodeTestCases extends JAXBWithJSONTestCases{ >+ >+ private final static String XML_RESOURCE = "org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.xml"; >+ private final static String JSON_RESOURCE = "org/eclipse/persistence/testing/jaxb/jaxbelement/dom/text.json"; >+ >+ >+ public TextNodeTestCases(String name) throws Exception { >+ super(name); >+ setContextPath("org.eclipse.persistence.testing.jaxb.jaxbelement.dom"); >+ setControlDocument(XML_RESOURCE); >+ setControlJSON(JSON_RESOURCE); >+ } >+ >+ @Override >+ protected Object getControlObject() { >+ ObjectFactory factory = new ObjectFactory(); >+ Document doc; >+ try { >+ doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); >+ Element elm = doc.createElementNS(null, "abcdef"); >+ elm.setTextContent("thetext"); >+ Object value = elm; >+ JAXBElement obj = factory.createDoc(value); >+ return obj; >+ } catch (Exception e) { >+ e.printStackTrace(); >+ fail("An exception was thrown."); >+ return null; >+ } >+ } >+ >+ >+} >diff --git a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java >index 0fbb4f5..05c9631 100644 >--- a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java >+++ b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/AnnotationsProcessor.java >@@ -834,7 +834,7 @@ public class AnnotationsProcessor { > JavaClass typeClass = property.getActualType(); > TypeInfo targetInfo = typeInfo.get(typeClass.getQualifiedName()); > if (targetInfo != null && targetInfo.isTransient() && property.getXmlElements() == null) { >- throw JAXBException.invalidReferenceToTransientClass(jClass.getQualifiedName(), property.getPropertyName(), typeClass.getQualifiedName()); >+ property.setTransientType(true); > } > // only one XmlValue is allowed per class, and if there is one > // only XmlAttributes are allowed >@@ -1825,26 +1825,19 @@ public class AnnotationsProcessor { > property.setElement(javaHasAnnotations); > > // if there is a TypeInfo for ptype check it for transient, otherwise >- // check the class >- TypeInfo pTypeInfo = typeInfo.get(ptype.getQualifiedName()); >- if ((pTypeInfo != null && !pTypeInfo.isTransient()) || !helper.isAnnotationPresent(ptype, XmlTransient.class)) { >- property.setType(ptype); >- } else { >- JavaClass parent = ptype.getSuperclass(); >- while (parent != null) { >- if (parent.getName().equals(JAVA_LANG_OBJECT)) { >- property.setType(parent); >- break; >- } >- // if there is a TypeInfo for parent check it for transient, >- // otherwise check the class >- TypeInfo parentTypeInfo = typeInfo.get(parent.getQualifiedName()); >- if ((parentTypeInfo != null && !parentTypeInfo.isTransient()) || !helper.isAnnotationPresent(parent, XmlTransient.class)) { >- property.setType(parent); >- break; >- } >- parent = parent.getSuperclass(); >+ // check the class >+ if (isCollectionType(ptype)) { >+ JavaClass componentType = helper.getJavaClass(Object.class);; >+ if(ptype.hasActualTypeArguments()){ >+ ArrayList typeArgs = (ArrayList) ptype.getActualTypeArguments(); >+ if(typeArgs.size() > 0) { >+ componentType = (JavaClass) typeArgs.get(0); >+ } > } >+ >+ updatePropertyType(property, ptype, componentType); >+ }else{ >+ updatePropertyType(property, ptype, ptype); > } > if((ptype.isArray() && !areEquals(ptype, byte[].class)) || (property.isCollectionType(ptype) && !helper.isAnnotationPresent(javaHasAnnotations, XmlList.class)) ){ > property.setNillable(true); >@@ -1958,6 +1951,31 @@ public class AnnotationsProcessor { > return property; > } > >+ >+ private void updatePropertyType(Property property, JavaClass ptype, JavaClass componentType){ >+ TypeInfo componentTypeInfo = typeInfo.get(componentType); >+ if((componentTypeInfo != null && !componentTypeInfo.isTransient()) || !helper.isAnnotationPresent(componentType, XmlTransient.class)){ >+ property.setType(ptype); >+ }else{ >+ JavaClass parent = componentType.getSuperclass(); >+ while (parent != null) { >+ if (parent.getName().equals(JAVA_LANG_OBJECT)) { >+ property.setTransientType(true); >+ property.setType(ptype); >+ break; >+ } >+ // if there is a TypeInfo for parent check it for transient, >+ // otherwise check the class >+ TypeInfo parentTypeInfo = typeInfo.get(parent.getQualifiedName()); >+ if ((parentTypeInfo != null && !parentTypeInfo.isTransient()) || !helper.isAnnotationPresent(parent, XmlTransient.class)) { >+ property.setType(parent); >+ break; >+ } >+ parent = parent.getSuperclass(); >+ } >+ } >+ } >+ > /** > * Build a new 'choice' property. Here, we flag a new property as a 'choice' > * and create/set an XmlModel XmlElements object based on the @XmlElements >diff --git a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java >index aeee220..08cc258 100644 >--- a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java >+++ b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/MappingsGenerator.java >@@ -1282,6 +1282,9 @@ public class MappingsGenerator { > } else { > mapping.setReferenceClassName(referenceClassName); > } >+ if(property.isTransientType()){ >+ mapping.setReferenceClassName(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS); >+ } > > if (property.getInverseReferencePropertyName() != null) { > mapping.setContainerAttributeName(property.getInverseReferencePropertyName()); >@@ -1988,12 +1991,15 @@ public class MappingsGenerator { > XMLField xmlField = getXPathForField(property, namespaceInfo, false); > mapping.setXPath(xmlField.getXPath()); > >- if (referenceClassName == null){ >+ if (referenceClassName == null){ > ((XMLField)mapping.getField()).setIsTypedTextField(true); > ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME); > } else { > mapping.setReferenceClassName(referenceClassName); > } >+ if(property.isTransientType()){ >+ mapping.setReferenceClassName(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS); >+ } > > if (property.isRequired()) { > ((XMLField) mapping.getField()).setRequired(true); >diff --git a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Property.java b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Property.java >index 2ceddac..26a3c90 100644 >--- a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Property.java >+++ b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Property.java >@@ -139,8 +139,10 @@ public class Property implements Cloneable { > private List<XmlJoinNodes> xmlJoinNodesList; > private boolean isSuperClassProperty; > >+ private boolean isTransientType; > private static final String MARSHAL_METHOD_NAME = "marshal"; > >+ > public Property() {} > > public Property(Helper helper) { >@@ -407,6 +409,16 @@ public class Property implements Cloneable { > return isRequired; > } > >+ >+ >+ public boolean isTransientType() { >+ return isTransientType; >+ } >+ >+ public void setTransientType(boolean isTransientType) { >+ this.isTransientType = isTransientType; >+ } >+ > public void setIsRequired(boolean b) { > isRequired = b; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 383424
:
222581
| 222584