Skip to content

Commit eee4356

Browse files
authored
Fix for XMLExporter issues in #2310 (#2313)
* #2176 Make LWJGLBufferAllocator use nmemCalloc() instead of nmemAlloc() #2176 LWJGLBufferAllocator.allocate() now always returns zero-initialized buffers. * Added unit tests for JmeExporter/JmeImporter implementations Tests all write* and read* methods of OutputCapsule and InputCapsule respectively. * Fixed XMLExporter/XMLImporter BitSets Previously DOMOutputCapsule was writing indices of set bits and DOMInputCapsule was reading values of each bit. Changed DOMOutputCapsule to match the expected behavior of DOMInputCapsule. * Fixed DOMInputCapsule.readString() returning defVal for empty strings org.w3c.dom.Element.getAttribute() returns an empty string for attributes that are not found. It looks like DOMInputCapsule.readString() was interpreting an empty string as the attribute not existing, and returning defVal even when the attribute did exist and was an empty string. Now it checks explicitly whether the attribute exists. * Deprecated DOMSerializer in favor of javax.xml.transform.Transformer DOMSerializer contains several edge-case issues that were only partially worked around with the encodeString() and decodeString() helper methods. Java has a robust built-in solution to serializing Document objects, and using that instead fixes several bugs. * Fixed NullPointerException when XMLExporter writes a String[] with null Also refactored all primitive array write and read methods to be more readable and reduce duplicate code. * Made DOM capsules reuse write/read primitive array methods for buffers Further reduces duplicate code * Fixed DOMOutputCapsule.write(Savable[][]) NullPointerException Refactored write and read methods for Savables and 1 and 2 dimensional Savable arrays. Fixed NullPointerException when writing a 2d Savable array containing a null element in the outer array. * Added Savable reference consistency test to InputOutputCapsuleTest * Fixed DOMInputCapsule throwing NullPointerException when reading list DOMInputCapsule used to throw a NullPointerException when reading an Arraylist containing a null element. Also refactored list write and read methods to clean up a bit and accidentally also fixed an unrelated bug where reading ArrayList<ByteBuffer> would return a list containing all null elements. * Made XMLExporter save and load buffer positions properly. * Cleanup and formatting for XMLExporter related classes * Undid XMLExporter saving buffer positions. Not saving positions is intentional #2312 (comment) * Fixed infinite recursion with XMLExporter Writing a Savable containing a reference loop caused infinite recursion due to bookkeeping being performed after the recursive call instead of before. Also added a unit test for this to InputOutputCapsuleTest.
1 parent e0953ad commit eee4356

File tree

7 files changed

+1751
-1718
lines changed

7 files changed

+1751
-1718
lines changed

0 commit comments

Comments
 (0)