From 9a5332381d98ca66f36385f2cf4d4cdbe5c45f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Bud=C3=A4us?= Date: Tue, 21 Jun 2022 11:21:40 +0200 Subject: Address SonarLint java:S2178 The use of non-short-circuit logic in a boolean context is likely a mistake - one that could cause serious program errors as conditions are evaluated under the wrong circumstances. --- src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java | 8 ++++---- src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java b/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java index 0d5d1da..c14af9e 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java +++ b/src/main/java/org/uic/barcode/asn1/uper/AsnExtractor.java @@ -42,10 +42,10 @@ public class AsnExtractor { if (extractionStarted || extractionCompleted) return false; - if (path != null && path.length() > 0 && className != null & className.length() > 0) { - if (className.endsWith(path)){ - return true; - } + if (path != null && path.length() > 0 && + className != null && className.length() > 0 && + className.endsWith(path)) { + return true; } return false; diff --git a/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java b/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java index d0ce782..290d1aa 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/SeqOfCoder.java @@ -29,7 +29,7 @@ class SeqOfCoder implements Decoder, Encoder { //CG pass annotations too each field encoding Annotation[] annotationArray = new Annotation[] {}; - if (annotations != null & annotations.getAnnotations() != null && !annotations.getAnnotations().isEmpty()) { + if (annotations != null && annotations.getAnnotations() != null && !annotations.getAnnotations().isEmpty()) { ArrayList fieldAnnotations = new ArrayList(); fieldAnnotations.addAll(annotations.getAnnotations()); annotationArray = new Annotation[fieldAnnotations.size()]; -- cgit v1.2.3