From 5b8f4c0eaeaf3f41e4013f358636414b4b07c288 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 3 Oct 2019 16:55:22 +0200 Subject: [PATCH] fixed some PME normals --- .../ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java | 2 +- .../ethz/seb/sebserver/gui/widget/FileUploadSelection.java | 4 +++- .../seb/sebserver/gui/widget/ImageUploadSelection.java | 4 +++- .../java/ch/ethz/seb/sebserver/gui/widget/Message.java | 7 ++++--- .../servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java | 1 + .../webservice/servicelayer/dao/impl/ExamDAOImpl.java | 1 + .../webservice/servicelayer/dao/impl/IndicatorDAOImpl.java | 1 + .../webservice/servicelayer/dao/impl/UserDAOImpl.java | 1 - 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java index b4603158..d8020861 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/user/UserInfo.java @@ -221,7 +221,7 @@ public final class UserInfo implements UserAccount, Activatable, Serializable { } @Override - protected Object clone() throws CloneNotSupportedException { + public Object clone() throws CloneNotSupportedException { return UserInfo.of(this); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/FileUploadSelection.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/FileUploadSelection.java index 5ef0b2c5..db8b6267 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/FileUploadSelection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/FileUploadSelection.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.function.Consumer; import org.eclipse.rap.fileupload.FileDetails; @@ -138,7 +139,8 @@ public class FileUploadSelection extends Composite { private boolean fileSupported(final String fileName) { return this.supportedFileExtensions .stream() - .filter(fileType -> fileName.toUpperCase().endsWith(fileType.toUpperCase())) + .filter(fileType -> fileName.toUpperCase(Locale.ROOT) + .endsWith(fileType.toUpperCase(Locale.ROOT))) .findFirst() .isPresent(); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/ImageUploadSelection.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/ImageUploadSelection.java index 96705d73..1e546534 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/ImageUploadSelection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/ImageUploadSelection.java @@ -16,6 +16,7 @@ import java.util.Arrays; import java.util.Base64; import java.util.Collections; import java.util.HashSet; +import java.util.Locale; import java.util.Set; import java.util.function.Consumer; @@ -189,7 +190,8 @@ public final class ImageUploadSelection extends Composite { private static boolean fileSupported(final String fileName) { return SUPPORTED_IMAGE_FILES .stream() - .filter(fileType -> fileName.toUpperCase().endsWith(fileType.toUpperCase())) + .filter(fileType -> fileName.toUpperCase(Locale.ROOT) + .endsWith(fileType.toUpperCase(Locale.ROOT))) .findFirst() .isPresent(); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/Message.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/Message.java index 80f4879c..52e3e0fc 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/Message.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/Message.java @@ -16,6 +16,7 @@ import org.eclipse.swt.widgets.Shell; public final class Message extends MessageBox { + private static final int NORMAL_WIDTH = 400; private static final long serialVersionUID = 6973272221493264432L; public Message(final Shell parent, final String title, final String message, final int type) { @@ -32,9 +33,9 @@ public final class Message extends MessageBox { layout.marginBottom = 10; super.shell.setData(RWT.CUSTOM_VARIANT, "message"); final Rectangle bounds = super.shell.getBounds(); - if (bounds.width < 400) { - bounds.x = bounds.x - (400 - bounds.width) / 2; - bounds.width = 400; + if (bounds.width < NORMAL_WIDTH) { + bounds.x = bounds.x - (NORMAL_WIDTH - bounds.width) / 2; + bounds.width = NORMAL_WIDTH; super.shell.setBounds(bounds); } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java index 3626682a..b62e005d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java @@ -282,6 +282,7 @@ public class ExamConfigurationMapDAOImpl implements ExamConfigurationMapDAO { break; default: selectionFunction = key -> Result.of(Collections.emptyList()); //empty select function + break; } return getDependencies(bulkAction, selectionFunction); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index 24d7bdda..2cc3a8fb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -302,6 +302,7 @@ public class ExamDAOImpl implements ExamDAO { break; default: selectionFunction = key -> Result.of(Collections.emptyList()); //empty select function + break; } return getDependencies(bulkAction, selectionFunction); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java index 247dd484..23da5eb4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/IndicatorDAOImpl.java @@ -245,6 +245,7 @@ public class IndicatorDAOImpl implements IndicatorDAO { break; default: selectionFunction = key -> Result.of(Collections.emptyList()); //empty select function + break; } return getDependencies(bulkAction, selectionFunction); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java index 1025276e..9e519cf3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java @@ -187,7 +187,6 @@ public class UserDAOImpl implements UserDAO { .flatMap(DAOLoggingSupport::logAndSkipOnError) .filter(_predicate) .collect(Collectors.toList()); - ; return userInfo; });