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() {
return this.errors
.stream()
.anyMatch(error -> Integer.valueOf(error.messageCode) < 1200);
.anyMatch(error -> Integer.parseInt(error.messageCode) < 1200);
}
@Override

View file

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

View file

@ -58,7 +58,7 @@ public class ExamConfigStateChange implements BatchActionExec {
public APIMessage checkConsistency(final Map<String, String> 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;

View file

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

View file

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

View file

@ -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<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
"sebMode",
"sebServerFallback",
@ -76,17 +76,17 @@ public class ExamConfigXMLParser extends DefaultHandler {
"whitelistURLFilter",
"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_TRUE,
Constants.XML_PLIST_STRING,
Constants.XML_PLIST_DATA,
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"));
public static final Set<String> SECRET_ATTRIBUTES = new HashSet<>(Arrays.asList(
public static final Set<String> SECRET_ATTRIBUTES = Utils.immutableSetOf(Arrays.asList(
"hashedQuitPassword",
"hashedAdminPassword"));