-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cxf dev2 #1516
base: main
Are you sure you want to change the base?
Cxf dev2 #1516
Conversation
@prathyushreddylpr I don't see any comparison logic in |
In the 'testDeserialization' there is a call to 'rhinoCallInContext' which internally calls deserializeTestBean3_1(serialized string) here: '
|
But it compares deserialized form of each attribute, the order does not matter here |
Yes but when the class is serialized to a string, the attributes does not follow any particular and when the string is compared with certain value it is causing the issue. For example, below are two serialized strings for two different runs: |
Could you please point out where this serialized string is compared to another serialized strings? I have found none such places, and the order does not matter here as far as all attributes have the same values. |
I don't see two items, I see (from your examples): and The other two string items belong to |
Sorry for the confusion, I have debugged the issue further and understood that the issue is not with the serializing of the string but with the parsing of the 'xmlString' here:
I observed that sometimes when the string is converted to XML, the attributes' values become null(see screenshot below), and defining propOrder will trigger a more consistent marshaling behavior within JAXB. When propOrder is defined, JAXB takes additional steps to ensure all properties are accounted for and processed systematically, which it might not do when relying on the default (implicit) order. |
Thanks @prathyushreddylpr , I am very surprised by your findings but if that is indeed the case, this definitely not a CXF but JAXB implementation issue (we use Glassfish one), could you please report it there? |
@reta , can you please let me know how I can report this to JAXB? Is this:https://github.com/eclipse-ee4j/glassfish the glassfish repo that you mentioned? |
@prathyushreddylpr I suppose you could open an issue there with the test case that demonstrates the problem with JAXB implementation (you may need to craft the reproducer without Apache CXF context since as per your explanation, it is purely dictated by JAXB with propOrder setting). |
Description
Fixed the flaky tests named
testDeserialization
insideSerializationTest.java
andAttributeTest.java
classes.cxf/rt/javascript/javascript-tests/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java
Line 91 in 3048785
cxf/rt/javascript/javascript-tests/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java
Line 73 in 3048785
Root Cause
The test
testDeserialization
has been reported as flaky when run with the NonDex tool. The tests failed because of the serialization of Testbean and AttributeTestBean classes, where the order of elements in the serialized XML changes between runs. The contents of the serialized strings do not remain constant and hence the tests are failing.Fix
To define a specific order for the XML elements when the classes TestBean1 and AttributeTestBean are serialized, we need to add the propOrder attribute to the @XmlType annotation. This attribute explicitly specifies the order in which fields should be serialized.
How this has been tested?
Java: openjdk version "11.0.20.1"
Maven: Apache Maven 3.6.3
Command used -
Command used -
Command used -
NonDex test passed after the fix.