Change in ovirt-engine[master]: core: Fix potential OvfParserTest NPE

From Allon Mureinik <amureini@redhat.com>:
Allon Mureinik has submitted this change and it was merged. Change subject: core: Fix potential OvfParserTest NPE ...................................................................... core: Fix potential OvfParserTest NPE OvfParser#utcDateStringToLocalDate may potentially return null (even though this is not possible in this test due to the hard-coded argument that's passed to it), causing static analysis tools such as Coverity or even IntelliJ IDEA to issue a warning on this test. This patch flips the test around and constructs a new Date object from the expected timestamp instead of extracting the timestamp from the parsed Date object. This change not only silences the aforementioned static analysis tools, but also makes the test a tad more resilient - if utcDateStringToLocalDate would ever be broken in the future in a way where it returns null for this argument the test would now fail cleanly instead of erroring out with a NullPointerException. This patch addresses Coverity CID 1376661. Change-Id: If23a59cd5f85085bd6c965ab653238c351e9d8a1 Signed-off-by: Allon Mureinik <amureini@redhat.com> --- M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jenkins CI: Passed CI tests Allon Mureinik: Verified Moti Asayag: Looks good to me, approved -- To view, visit https://gerrit.ovirt.org/78687 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If23a59cd5f85085bd6c965ab653238c351e9d8a1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <amureini@redhat.com> Gerrit-Reviewer: Allon Mureinik <amureini@redhat.com> Gerrit-Reviewer: Arik Hadas <ahadas@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Moti Asayag <masayag@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
Code Review