diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCallError.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCallError.java index 076f70c6..52572a0e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCallError.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestCallError.java @@ -55,7 +55,7 @@ public class RestCallError extends RuntimeException implements APIMessageError { public boolean isUnexpectedError() { return this.errors .stream() - .anyMatch(error -> Integer.valueOf(error.messageCode) < 1200); + .anyMatch(error -> Integer.parseInt(error.messageCode) < 1200); } @Override diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ProctoringGUIService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ProctoringGUIService.java index 63451f1e..efc0d333 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ProctoringGUIService.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ProctoringGUIService.java @@ -8,6 +8,7 @@ package ch.ethz.seb.sebserver.gui.service.session.proctoring; +import java.io.Serializable; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -247,7 +248,8 @@ public class ProctoringGUIService { } } - public static class ProctoringWindowData { + public static class ProctoringWindowData implements Serializable { + private static final long serialVersionUID = -9060185011534956417L; public final String windowName; public final String examId; public final ProctoringRoomConnection connectionData; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/impl/ExamConfigStateChange.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/impl/ExamConfigStateChange.java index 489a8841..bd7a42bb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/impl/ExamConfigStateChange.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/bulkaction/impl/ExamConfigStateChange.java @@ -58,7 +58,7 @@ public class ExamConfigStateChange implements BatchActionExec { public APIMessage checkConsistency(final Map actionAttributes) { final ConfigurationStatus targetState = getTargetState(actionAttributes); if (targetState == null) { - APIMessage.ErrorMessage.ILLEGAL_API_ARGUMENT + return APIMessage.ErrorMessage.ILLEGAL_API_ARGUMENT .of("Missing target state attribute for EXAM_CONFIG_STATE_CHANGE batch action"); } return null; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/SEBClientConfigDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/SEBClientConfigDAOImpl.java index 6b19a497..b8368609 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/SEBClientConfigDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/SEBClientConfigDAOImpl.java @@ -429,7 +429,7 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO { : ConfigPurpose.START_EXAM, additionalAttributes.containsKey(SEBClientConfig.ATTR_PING_INTERVAL) ? Long - .valueOf(additionalAttributes.get(SEBClientConfig.ATTR_PING_INTERVAL).getValue()) + .parseLong(additionalAttributes.get(SEBClientConfig.ATTR_PING_INTERVAL).getValue()) : 1000L, additionalAttributes.containsKey(SEBClientConfig.ATTR_VDI_TYPE) ? VDIType diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/legacy/MoodleCourseDataAsyncLoader.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/legacy/MoodleCourseDataAsyncLoader.java index 35056b6f..aa9977f4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/legacy/MoodleCourseDataAsyncLoader.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/legacy/MoodleCourseDataAsyncLoader.java @@ -255,35 +255,31 @@ public class MoodleCourseDataAsyncLoader { return true; } - if (courseQuizData.quizzes != null) { - courseQuizData.quizzes - .stream() - .filter(getQuizFilter()) - .forEach(quiz -> { - final CourseDataShort data = courseData.get(quiz.course); - if (data != null) { - data.quizzes.add(quiz); - } - }); + courseQuizData.quizzes + .stream() + .filter(getQuizFilter()) + .forEach(quiz -> { + final CourseDataShort data = courseData.get(quiz.course); + if (data != null) { + data.quizzes.add(quiz); + } + }); - courseData.values().stream() - .filter(c -> !c.quizzes.isEmpty()) - .forEach(c -> { - if (this.cachedCourseData.size() >= this.maxSize) { - log.error( - "LMS Setup: {} Cache is full and has reached its maximal size. Skip data: -> {}", - this.lmsSetup, - c); - } else { - this.cachedCourseData.put(c.id, c); - this.newIds.add(c.id); - } - }); + courseData.values().stream() + .filter(c -> !c.quizzes.isEmpty()) + .forEach(c -> { + if (this.cachedCourseData.size() >= this.maxSize) { + log.error( + "LMS Setup: {} Cache is full and has reached its maximal size. Skip data: -> {}", + this.lmsSetup, + c); + } else { + this.cachedCourseData.put(c.id, c); + this.newIds.add(c.id); + } + }); - return true; - } else { - return false; - } + return true; } catch (final Exception e) { log.error("LMS Setup: {} Unexpected exception while trying to get course data: ", this.lmsSetup, e); return false; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigXMLParser.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigXMLParser.java index 197eadd4..3be69f38 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigXMLParser.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigXMLParser.java @@ -9,7 +9,6 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; import java.util.Stack; import java.util.function.Consumer; @@ -28,6 +27,7 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.AttributeType; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue; import ch.ethz.seb.sebserver.gbl.util.Cryptor; +import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl.ExamConfigXMLParser.PListNode.Type; import ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl.converter.KioskModeConverter; @@ -37,7 +37,7 @@ public class ExamConfigXMLParser extends DefaultHandler { // comma separated list of SEB exam config keys that can be ignored on imports // See: https://jira.let.ethz.ch/browse/SEBSERV-100 - private static final Set SEB_EXAM_CONFIG_KEYS_TO_IGNORE = new HashSet<>(Arrays.asList( + private static final Set SEB_EXAM_CONFIG_KEYS_TO_IGNORE = Utils.immutableSetOf(Arrays.asList( // SEB Server specific "sebMode", "sebServerFallback", @@ -76,17 +76,17 @@ public class ExamConfigXMLParser extends DefaultHandler { "whitelistURLFilter", "URLFilterIgnoreList")); - private static final Set VALUE_ELEMENTS = new HashSet<>(Arrays.asList( + private static final Set VALUE_ELEMENTS = Utils.immutableSetOf(Arrays.asList( Constants.XML_PLIST_BOOLEAN_FALSE, Constants.XML_PLIST_BOOLEAN_TRUE, Constants.XML_PLIST_STRING, Constants.XML_PLIST_DATA, Constants.XML_PLIST_INTEGER)); - private static final Set KNOWN_INLINE_TABLES = new HashSet<>(Arrays.asList( + private static final Set KNOWN_INLINE_TABLES = Utils.immutableSetOf(Arrays.asList( "arguments")); - public static final Set SECRET_ATTRIBUTES = new HashSet<>(Arrays.asList( + public static final Set SECRET_ATTRIBUTES = Utils.immutableSetOf(Arrays.asList( "hashedQuitPassword", "hashedAdminPassword"));