fixed some finde-bugs issues

This commit is contained in:
anhefti 2022-01-18 14:31:57 +01:00
parent b1b582028f
commit 917f55da6f
6 changed files with 21 additions and 6 deletions

View file

@ -35,5 +35,19 @@
<Package name="ch.ethz.seb.sebserver.gui.service.page" />
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
</Match>
<Match>
<Package name="ch.ethz.seb.sebserver.gui.service.page" />
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
</Match>
<Match>
<Package name="ch.ethz.seb.sebserver.webservice.servicelayer.session.impl.proctoring" />
<Bug pattern="URF_UNREAD_FIELD" />
</Match>
<Match>
<Package name="ch.ethz.seb.sebserver.webservice.servicelayer.session.impl.proctoring" />
<Bug pattern="SS_SHOULD_BE_STATIC" />
</Match>
</FindBugsFilter>

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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

View file

@ -222,7 +222,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
private List<QuizData> 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;

View file

@ -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;
}
}