diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamProctoringSettings.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamProctoringSettings.java index 9dcfcb30..a8771350 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamProctoringSettings.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamProctoringSettings.java @@ -139,11 +139,12 @@ public class ExamProctoringSettings { .valueOf(form.getFieldValue(ProctoringServiceSettings.ATTR_SERVER_TYPE)); final String features = form.getFieldValue(ProctoringServiceSettings.ATTR_ENABLED_FEATURES); - final EnumSet featureFlags = - EnumSet.copyOf(Arrays.asList(StringUtils.split(features, Constants.LIST_SEPARATOR)) + final EnumSet featureFlags = (StringUtils.isNotBlank(features)) + ? EnumSet.copyOf(Arrays.asList(StringUtils.split(features, Constants.LIST_SEPARATOR)) .stream() .map(str -> ProctoringFeature.valueOf(str)) - .collect(Collectors.toSet())); + .collect(Collectors.toSet())) + : EnumSet.noneOf(ProctoringFeature.class); examProctoring = new ProctoringServiceSettings( Long.parseLong(entityKey.modelId), diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/ExamAdminServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/ExamAdminServiceImpl.java index e00d9c60..bacadf7b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/ExamAdminServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/ExamAdminServiceImpl.java @@ -328,20 +328,22 @@ public class ExamAdminServiceImpl implements ExamAdminService { if (mapping.containsKey(ProctoringServiceSettings.ATTR_ENABLED_FEATURES)) { try { final String value = mapping.get(ProctoringServiceSettings.ATTR_ENABLED_FEATURES).getValue(); - return EnumSet.copyOf(Arrays.asList(StringUtils.split(value, Constants.LIST_SEPARATOR)) - .stream() - .map(str -> { - try { - return ProctoringFeature.valueOf(str); - } catch (final Exception e) { - log.error( - "Failed to enabled single features for proctoring settings. Skipping. {}", - e.getMessage()); - return null; - } - }) - .filter(Objects::nonNull) - .collect(Collectors.toSet())); + return StringUtils.isNotBlank(value) + ? EnumSet.copyOf(Arrays.asList(StringUtils.split(value, Constants.LIST_SEPARATOR)) + .stream() + .map(str -> { + try { + return ProctoringFeature.valueOf(str); + } catch (final Exception e) { + log.error( + "Failed to enabled single features for proctoring settings. Skipping. {}", + e.getMessage()); + return null; + } + }) + .filter(Objects::nonNull) + .collect(Collectors.toSet())) + : EnumSet.noneOf(ProctoringFeature.class); } catch (final Exception e) { log.error("Failed to get enabled features for proctoring settings. Enable all. {}", e.getMessage()); return EnumSet.allOf(ProctoringFeature.class);