From 917f55da6fc88ca610ca2fbcc0bd342af79d3fb4 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 18 Jan 2022 14:31:57 +0100 Subject: [PATCH] fixed some finde-bugs issues --- findbugs-excludes.xml | 14 ++++++++++++++ .../gbl/model/session/ClientConnectionData.java | 3 ++- .../gui/content/activity/ActivitiesPane.java | 2 +- .../servicelayer/lms/impl/LmsAPIServiceImpl.java | 2 +- .../lms/impl/olat/OlatLmsAPITemplate.java | 2 +- .../sebconfig/impl/AbstractCertificateCryptor.java | 4 ++-- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/findbugs-excludes.xml b/findbugs-excludes.xml index b18fa80f..f00fbd66 100644 --- a/findbugs-excludes.xml +++ b/findbugs-excludes.xml @@ -35,5 +35,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java index 3092f078..4916e3ce 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnectionData.java @@ -100,7 +100,8 @@ public class ClientConnectionData { while (i1.hasNext()) { final IndicatorValue iv1 = i1.next(); final IndicatorValue iv2 = i2.next(); - if (iv1.getIndicatorId() != iv2.getIndicatorId() || Math.abs(iv1.getValue() - iv2.getValue()) > 0.1) { + if (iv1.getIndicatorId().longValue() != iv2.getIndicatorId().longValue() || + Math.abs(iv1.getValue() - iv2.getValue()) > 0.1) { return false; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/activity/ActivitiesPane.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/activity/ActivitiesPane.java index a0e8b7d9..35b35bd0 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/activity/ActivitiesPane.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/activity/ActivitiesPane.java @@ -472,7 +472,7 @@ public class ActivitiesPane implements TemplateComposer { ? tree.getSelection()[0] : (TreeItem) event.item; - if (treeItem.getItemCount() > 0 && !treeItem.getExpanded()) { + if (treeItem == null || (treeItem.getItemCount() > 0 && !treeItem.getExpanded())) { return; } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java index 5f363f14..95a7e9f9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java @@ -193,7 +193,7 @@ public class LmsAPIServiceImpl implements LmsAPIService { final LmsAPITemplate template = getLmsAPITemplate(lmsSetupId) .getOrThrow(); - if (institutionId != null && template.lmsSetup().institutionId != institutionId) { + if (institutionId != null && institutionId.equals(template.lmsSetup().institutionId)) { return Collections.emptyList(); } return template diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java index 27408b08..3a84b410 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java @@ -222,7 +222,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm private List collectAllQuizzes(final OlatLmsRestTemplate restTemplate, final FilterMap filterMap) { final LmsSetup lmsSetup = this.apiTemplateDataSupplier.getLmsSetup(); - final String quizName = filterMap.getString(QuizData.FILTER_ATTR_QUIZ_NAME); + final String quizName = (filterMap != null) ? filterMap.getString(QuizData.FILTER_ATTR_QUIZ_NAME) : null; final DateTime quizFromTime = (filterMap != null) ? filterMap.getQuizFromTime() : null; final long fromCutTime = (quizFromTime != null) ? Utils.toUnixTimeInSeconds(quizFromTime) : -1; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/AbstractCertificateCryptor.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/AbstractCertificateCryptor.java index 4da634c7..84eb9115 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/AbstractCertificateCryptor.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/AbstractCertificateCryptor.java @@ -11,8 +11,8 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl; import java.io.IOException; import java.io.InputStream; import java.security.cert.Certificate; +import java.util.Arrays; import java.util.Enumeration; -import java.util.Objects; import javax.crypto.Cipher; @@ -49,7 +49,7 @@ public abstract class AbstractCertificateCryptor { while (engineAliases.hasMoreElements()) { final Certificate certificate = certs.keyStore.engineGetCertificate(engineAliases.nextElement()); final byte[] otherPublicKeyHash = generatePublicKeyHash(certificate); - if (Objects.equals(otherPublicKeyHash, publicKeyHash)) { + if (Arrays.equals(otherPublicKeyHash, publicKeyHash)) { return certificate; } }