Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346081

Summary: Insecure behavior of <xml-transient/> vs @XmlTransient
Product: z_Archived Reporter: Xyan Kruse <xyan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: blaise.doughan, denise.mahar, eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Possible solution
denise.mahar: iplog+
Patch as proposed plus test case none

Description Xyan Kruse CLA 2011-05-17 09:04:09 EDT
Build Identifier: 2.2.0.v20110202-r8913

While finalizing properties @XmlTransient marked properties got skipped <xml-transient/> marked ones not.
These can break context creation in case the property points to an transient marked class and throws JAXBException.

Exception:
JAXBException - Property [*] in class [*] references a class [*] that is marked transient, which is not allowed.
on: finalizeProperties(AnnotationsProcessor.java:648)

The error is caused on AnnotationsProcessor:
599            // add properties
600            info.setProperties(getPropertiesForClass(javaClass, info));
601
602            // process properties
603            processTypeInfoProperties(javaClass, info);

An possible solution would be when processTypeInfoProperties(*) finds out that a property is transient via orm it should be removed from TypeInfo internal list.

Reproducible: Always

Steps to Reproduce:
1. use orm to mark an property and its type transient
2. try to create an JAXBContext
Comment 1 Xyan Kruse CLA 2011-05-17 10:48:45 EDT
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/XMLProcessor.java
Index: XMLProcessor.java
===================================================================
--- XMLProcessor.java	(Revision 9398)
+++ XMLProcessor.java	(Arbeitskopie)
@@ -453,6 +453,10 @@
                 }

                 

                 processJavaAttribute(typeInfo, javaAttribute, propToProcess, nsInfo, javaType);

+                // (Bug 346081) if discover an transient attribute apply same behavior as transient annotation and remove

+                if(propToProcess.isTransient()){

+                    typeInfo.getPropertyList().remove(propToProcess);

+                }

 

                 // if we are dealing with multiple mappings for the same attribute, leave the existing

                 // property as-is and update the additionalProperties list on the owning TypeInfo
Comment 2 Xyan Kruse CLA 2011-05-17 10:50:54 EDT
Created attachment 195868 [details]
Possible solution
Comment 3 Denise Smith CLA 2011-05-19 10:37:25 EDT
Created attachment 196115 [details]
Patch as proposed plus test case
Comment 4 Denise Smith CLA 2011-05-19 10:53:41 EDT
Fixed to remove the property from the list of properties if it is transient as proposed.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:16:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:35:27 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink