open-dis / opendis7-source-generator

Project to generate a type-safe Java implementation of the DIS Protocol version 7, IEEE 1278.1-2012 and SISO-REF-010 Enumerations specifications.
Other
5 stars 10 forks source link

Unsafe equalsImpl for object list attributes #8

Closed arttu-salminen-insta-fi closed 9 months ago

arttu-salminen-insta-fi commented 11 months ago

Generated equalsImpl methods do unsafe checks for OBJECT_LIST type attributes. Method will throw IndexOutOfBoundsException when other object list is shorter that this object list. Equals method should not throw exceptions, list sizes should be compared before trying to access variables in the list.

brutzman commented 11 months ago

Thank you for this report. When convenient please identify an example class/method with code snippet to help ensure that we address the correct code blocks.

terry-norbraten commented 10 months ago

Screen Shot 2023-11-28 at 15 22 08 Screen Shot 2023-11-28 at 15 22 32 Screen Shot 2023-11-28 at 15 22 54

arttu-salminen-insta-fi commented 10 months ago

Solution to this issue can be found here: https://github.com/arttu-salminen-insta-fi/opendis7-source-generator/commit/91707b217fccab938183b29685d5611c02987a48 . This solution also provides null safe equals checks to SISO_BITFIELD and CLASSREF types while increasing the performance of equals checks. We'll create a pull request to this project.

arttu-salminen-insta-fi commented 10 months ago

We've added solution to this issue to a previous pull request: https://github.com/open-dis/opendis7-source-generator/pull/15

brutzman commented 9 months ago

Implemented as part of pull request.