From 336d94aa7cf3e23b5b62772504edb0d1daeb9520 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Wed, 4 Oct 2023 15:38:04 +0100 Subject: Java 17 and sonar fixes. - change on maven.compiler to new resource property targeting java 17 version - sonar bugs on try-resource and some code smells Issue-ID: POLICY-4677 Issue-ID: POLICY-4837 Change-Id: I50a2170db80619c2ac95131ab5c91a6f767a5c30 Signed-off-by: adheli.tavares --- .../controller/usecases/GetTargetEntityOperation2.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'controlloop/common/controller-usecases') diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java index f9d90af4d..29689edf7 100644 --- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java +++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,16 +93,11 @@ public class GetTargetEntityOperation2 extends OperationPartial { throw new IllegalArgumentException("The target type is null"); } - switch (targetType) { - case PNF: - return detmPnfTarget(); - case VM: - case VNF: - case VFMODULE: - return detmVfModuleTarget(); - default: - throw new IllegalArgumentException("The target type is not supported"); - } + return switch (targetType) { + case PNF -> detmPnfTarget(); + case VM, VNF, VFMODULE -> detmVfModuleTarget(); + default -> throw new IllegalArgumentException("The target type is not supported"); + }; } /** -- cgit 1.2.3-korg