From tjelinek at redhat.com Thu Apr 28 06:47:16 2016 Content-Type: multipart/mixed; boundary="===============2006167903333103883==" MIME-Version: 1.0 From: tjelinek at redhat.com To: engine-commits at ovirt.org Subject: Change in ovirt-engine[master]: core: fixed gotcha in jdk8 streams Date: Thu, 28 Apr 2016 06:47:15 -0400 Message-ID: <201604281047.u3SAlF0j014634@gerrit.ovirt.org> In-Reply-To: gerrit.1461689333287.Ie15941484acb6eb0420bc55d72d5cbd9f3b5b1b2@gerrit.ovirt.org --===============2006167903333103883== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Tomas Jelinek has submitted this change and it was merged. Change subject: core: fixed gotcha in jdk8 streams ...................................................................... core: fixed gotcha in jdk8 streams code .findFirst().orElse(null) does NOT return first instance in stream or null. It returns first instance, if there's non-null first instance. It returns null if stream is empty. And throws NPE, when there's null valued instance in stream. Javadoc: /** * Returns an {@link Optional} describing the first element of this stream, * or an empty {@code Optional} if the stream is empty. If the stream has * no encounter order, then any element may be returned. * *

This is a short-circuiting * terminal operation. * * @return an {@code Optional} describing the first element of this stream, * or an empty {@code Optional} if the stream is empty * @throws NullPointerException if the element selected is null */ Change-Id: Ie15941484acb6eb0420bc55d72d5cbd9f3b5b1b2 Signed-off-by: Martin Mucha --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/netwo= rk/NetworkConfigurator.java A backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/netwo= rk/NetworkConfiguratorTest.java 2 files changed, 60 insertions(+), 7 deletions(-) Approvals: Martin Mucha: Verified Jenkins CI: Passed CI tests Allon Mureinik: Looks good to me, approved Yevgeny Zaspitsky: Looks good to me, but someone else must approve -- = To view, visit https://gerrit.ovirt.org/56646 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie15941484acb6eb0420bc55d72d5cbd9f3b5b1b2 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Marcin Mirecki Gerrit-Reviewer: Martin Mucha Gerrit-Reviewer: Tomas Jelinek Gerrit-Reviewer: Yevgeny Zaspitsky Gerrit-Reviewer: gerrit-hooks --===============2006167903333103883==--