fixed code

This commit is contained in:
anhefti 2022-08-30 16:16:11 +02:00
parent e5ac36c010
commit 7fdff4e2df
6 changed files with 34 additions and 36 deletions

View file

@ -55,7 +55,7 @@ public class RestCallError extends RuntimeException implements APIMessageError {
public boolean isUnexpectedError() { public boolean isUnexpectedError() {
return this.errors return this.errors
.stream() .stream()
.anyMatch(error -> Integer.valueOf(error.messageCode) < 1200); .anyMatch(error -> Integer.parseInt(error.messageCode) < 1200);
} }
@Override @Override

View file

@ -8,6 +8,7 @@
package ch.ethz.seb.sebserver.gui.service.session.proctoring; package ch.ethz.seb.sebserver.gui.service.session.proctoring;
import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; 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 windowName;
public final String examId; public final String examId;
public final ProctoringRoomConnection connectionData; public final ProctoringRoomConnection connectionData;

View file

@ -58,7 +58,7 @@ public class ExamConfigStateChange implements BatchActionExec {
public APIMessage checkConsistency(final Map<String, String> actionAttributes) { public APIMessage checkConsistency(final Map<String, String> actionAttributes) {
final ConfigurationStatus targetState = getTargetState(actionAttributes); final ConfigurationStatus targetState = getTargetState(actionAttributes);
if (targetState == null) { 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"); .of("Missing target state attribute for EXAM_CONFIG_STATE_CHANGE batch action");
} }
return null; return null;

View file

@ -429,7 +429,7 @@ public class SEBClientConfigDAOImpl implements SEBClientConfigDAO {
: ConfigPurpose.START_EXAM, : ConfigPurpose.START_EXAM,
additionalAttributes.containsKey(SEBClientConfig.ATTR_PING_INTERVAL) additionalAttributes.containsKey(SEBClientConfig.ATTR_PING_INTERVAL)
? Long ? Long
.valueOf(additionalAttributes.get(SEBClientConfig.ATTR_PING_INTERVAL).getValue()) .parseLong(additionalAttributes.get(SEBClientConfig.ATTR_PING_INTERVAL).getValue())
: 1000L, : 1000L,
additionalAttributes.containsKey(SEBClientConfig.ATTR_VDI_TYPE) additionalAttributes.containsKey(SEBClientConfig.ATTR_VDI_TYPE)
? VDIType ? VDIType

View file

@ -255,35 +255,31 @@ public class MoodleCourseDataAsyncLoader {
return true; return true;
} }
if (courseQuizData.quizzes != null) { courseQuizData.quizzes
courseQuizData.quizzes .stream()
.stream() .filter(getQuizFilter())
.filter(getQuizFilter()) .forEach(quiz -> {
.forEach(quiz -> { final CourseDataShort data = courseData.get(quiz.course);
final CourseDataShort data = courseData.get(quiz.course); if (data != null) {
if (data != null) { data.quizzes.add(quiz);
data.quizzes.add(quiz); }
} });
});
courseData.values().stream() courseData.values().stream()
.filter(c -> !c.quizzes.isEmpty()) .filter(c -> !c.quizzes.isEmpty())
.forEach(c -> { .forEach(c -> {
if (this.cachedCourseData.size() >= this.maxSize) { if (this.cachedCourseData.size() >= this.maxSize) {
log.error( log.error(
"LMS Setup: {} Cache is full and has reached its maximal size. Skip data: -> {}", "LMS Setup: {} Cache is full and has reached its maximal size. Skip data: -> {}",
this.lmsSetup, this.lmsSetup,
c); c);
} else { } else {
this.cachedCourseData.put(c.id, c); this.cachedCourseData.put(c.id, c);
this.newIds.add(c.id); this.newIds.add(c.id);
} }
}); });
return true; return true;
} else {
return false;
}
} catch (final Exception e) { } catch (final Exception e) {
log.error("LMS Setup: {} Unexpected exception while trying to get course data: ", this.lmsSetup, e); log.error("LMS Setup: {} Unexpected exception while trying to get course data: ", this.lmsSetup, e);
return false; return false;

View file

@ -9,7 +9,6 @@
package ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl; package ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import java.util.function.Consumer; 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.ConfigurationAttribute;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
import ch.ethz.seb.sebserver.gbl.util.Cryptor; 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.ExamConfigXMLParser.PListNode.Type;
import ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl.converter.KioskModeConverter; 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 // comma separated list of SEB exam config keys that can be ignored on imports
// See: https://jira.let.ethz.ch/browse/SEBSERV-100 // See: https://jira.let.ethz.ch/browse/SEBSERV-100
private static final Set<String> SEB_EXAM_CONFIG_KEYS_TO_IGNORE = new HashSet<>(Arrays.asList( private static final Set<String> SEB_EXAM_CONFIG_KEYS_TO_IGNORE = Utils.immutableSetOf(Arrays.asList(
// SEB Server specific // SEB Server specific
"sebMode", "sebMode",
"sebServerFallback", "sebServerFallback",
@ -76,17 +76,17 @@ public class ExamConfigXMLParser extends DefaultHandler {
"whitelistURLFilter", "whitelistURLFilter",
"URLFilterIgnoreList")); "URLFilterIgnoreList"));
private static final Set<String> VALUE_ELEMENTS = new HashSet<>(Arrays.asList( private static final Set<String> VALUE_ELEMENTS = Utils.immutableSetOf(Arrays.asList(
Constants.XML_PLIST_BOOLEAN_FALSE, Constants.XML_PLIST_BOOLEAN_FALSE,
Constants.XML_PLIST_BOOLEAN_TRUE, Constants.XML_PLIST_BOOLEAN_TRUE,
Constants.XML_PLIST_STRING, Constants.XML_PLIST_STRING,
Constants.XML_PLIST_DATA, Constants.XML_PLIST_DATA,
Constants.XML_PLIST_INTEGER)); Constants.XML_PLIST_INTEGER));
private static final Set<String> KNOWN_INLINE_TABLES = new HashSet<>(Arrays.asList( private static final Set<String> KNOWN_INLINE_TABLES = Utils.immutableSetOf(Arrays.asList(
"arguments")); "arguments"));
public static final Set<String> SECRET_ATTRIBUTES = new HashSet<>(Arrays.asList( public static final Set<String> SECRET_ATTRIBUTES = Utils.immutableSetOf(Arrays.asList(
"hashedQuitPassword", "hashedQuitPassword",
"hashedAdminPassword")); "hashedAdminPassword"));