From e5ac36c01064305472be0fb2f11da2f4a1cfae42 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 30 Aug 2022 14:51:28 +0200 Subject: [PATCH] code fixes --- src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java | 4 ++-- .../ch/ethz/seb/sebserver/gbl/model/exam/ClientGroup.java | 4 ++-- .../seb/sebserver/gbl/model/session/ClientConnection.java | 4 ++-- .../gui/service/examconfig/impl/ViewGridBuilder.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java index 82117ed8..151ad3bb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java @@ -9,7 +9,6 @@ package ch.ethz.seb.sebserver.gbl; import java.text.Collator; -import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Locale; @@ -25,6 +24,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import ch.ethz.seb.sebserver.gbl.api.APIMessage; import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.api.authorization.Privilege; +import ch.ethz.seb.sebserver.gbl.util.Utils; /** Global Constants used in SEB Server web-service as well as in web-gui component */ public final class Constants { @@ -162,7 +162,7 @@ public final class Constants { public static final Collator DEFAULT_ENGLISH_COLLATOR = Collator.getInstance(Locale.ENGLISH); - public static final List ENTITY_TYPE_HIRARCHIE = Arrays.asList( + public static final List ENTITY_TYPE_HIRARCHIE = Utils.immutableListOf( EntityType.INSTITUTION, EntityType.USER, EntityType.USER_ACTIVITY_LOG, diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/ClientGroup.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/ClientGroup.java index 7731e0f5..804887b9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/ClientGroup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/ClientGroup.java @@ -101,11 +101,10 @@ public class ClientGroup implements ClientGroupData { this.examId = examId; this.name = name; this.type = type == null ? ClientGroupType.NONE : type; - ; this.color = color; this.icon = icon; - switch (type) { + switch (this.type) { case IP_V4_RANGE: { final String[] split = StringUtils.split(data, Constants.EMBEDDED_LIST_SEPARATOR); this.ipRangeStart = split[0]; @@ -123,6 +122,7 @@ public class ClientGroup implements ClientGroupData { this.ipRangeStart = null; this.ipRangeEnd = null; this.clientOS = ClientOS.NONE; + break; } } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java index fc441abb..bf63cb31 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java @@ -8,7 +8,6 @@ package ch.ethz.seb.sebserver.gbl.model.session; -import java.util.Arrays; import java.util.Collections; import java.util.EnumSet; import java.util.List; @@ -23,6 +22,7 @@ import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.Domain; import ch.ethz.seb.sebserver.gbl.model.GrantEntity; +import ch.ethz.seb.sebserver.gbl.util.Utils; @JsonIgnoreProperties(ignoreUnknown = true) public final class ClientConnection implements GrantEntity { @@ -48,7 +48,7 @@ public final class ClientConnection implements GrantEntity { } } - public final static List ACTIVE_STATES = Arrays.asList( + public final static List ACTIVE_STATES = Utils.immutableListOf( ConnectionStatus.ACTIVE.name(), ConnectionStatus.AUTHENTICATED.name(), ConnectionStatus.CONNECTION_REQUESTED.name()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java index c62b1dc0..1988179d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java @@ -37,7 +37,7 @@ public class ViewGridBuilder { private static final Logger log = LoggerFactory.getLogger(ViewGridBuilder.class); - public static Pattern EXPAND_BAR_GROUP_PATTERN = Pattern.compile("\\[(.*?)\\]"); + public static final Pattern EXPAND_BAR_GROUP_PATTERN = Pattern.compile("\\[(.*?)\\]"); final ExamConfigurationService examConfigurationService; final Composite parent;