From 3cd18d07970442dcd36e278cf1ed1b50661543a3 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 7 Mar 2019 13:19:30 +0100 Subject: [PATCH] fixed some find bugs issues --- .../service/page/impl/PageContextImpl.java | 10 +++++--- .../remote/webservice/auth/CurrentUser.java | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java index 1e5b820c..2672a527 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java @@ -8,6 +8,7 @@ package ch.ethz.seb.sebserver.gui.service.page.impl; +import java.io.Serializable; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; @@ -344,9 +345,9 @@ public class PageContextImpl implements PageContext { + "]"; } - private final class ConfirmDialogCallback implements DialogCallback { + private static final class ConfirmDialogCallback implements DialogCallback { private static final long serialVersionUID = 1491270214433492441L; - private transient final Runnable onOK; + private final Runnable onOK; private ConfirmDialogCallback(final Runnable onOK) { this.onOK = onOK; @@ -366,7 +367,10 @@ public class PageContextImpl implements PageContext { } } - private static final class ListenerComparator implements Comparator> { + private static final class ListenerComparator implements Comparator>, Serializable { + + private static final long serialVersionUID = 2571739214439340404L; + @Override public int compare(final PageEventListener o1, final PageEventListener o2) { final int x = o1.priority(); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java index a0d0fd43..475f87f6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/auth/CurrentUser.java @@ -166,6 +166,10 @@ public class CurrentUser { } } + private static final ParameterizedTypeReference> PRIVILEGE_LIST_TYPE_REF = + new ParameterizedTypeReference<>() { + }; + private boolean loadPrivileges() { if (this.privileges != null) { return true; @@ -183,8 +187,7 @@ public class CurrentUser { .toUriString(), HttpMethod.GET, HttpEntity.EMPTY, - new ParameterizedTypeReference>() { - }); + PRIVILEGE_LIST_TYPE_REF); if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) { this.privileges = exchange.getBody().stream() @@ -223,42 +226,42 @@ public class CurrentUser { } /** Checks the base read-only privilege grant - * + * * @return true on read-only privilege grant on wrapped EntityType */ public boolean r() { return hasBasePrivilege(PrivilegeType.READ_ONLY, this.entityType); } /** Checks the base modify privilege grant - * + * * @return true on modify privilege grant on wrapped EntityType */ public boolean m() { return hasBasePrivilege(PrivilegeType.MODIFY, this.entityType); } /** Checks the base write privilege grant - * + * * @return true on write privilege grant on wrapped EntityType */ public boolean w() { return hasBasePrivilege(PrivilegeType.WRITE, this.entityType); } /** Checks the institutional read-only privilege grant - * + * * @return true institutional read-only privilege grant on wrapped EntityType */ public boolean ir() { return hasInstitutionalPrivilege(PrivilegeType.READ_ONLY, this.entityType); } /** Checks the institutional modify privilege grant - * + * * @return true institutional modify privilege grant on wrapped EntityType */ public boolean im() { return hasInstitutionalPrivilege(PrivilegeType.MODIFY, this.entityType); } /** Checks the institutional write privilege grant - * + * * @return true institutional write privilege grant on wrapped EntityType */ public boolean iw() { return hasInstitutionalPrivilege(PrivilegeType.WRITE, this.entityType); @@ -274,21 +277,21 @@ public class CurrentUser { } /** Checks the read-only privilege grant for wrapped grantEntity - * + * * @return true on read-only privilege grant for wrapped grantEntity */ public boolean r() { return hasPrivilege(PrivilegeType.READ_ONLY, this.grantEntity); } /** Checks the modify privilege grant for wrapped grantEntity - * + * * @return true on modify privilege grant for wrapped grantEntity */ public boolean m() { return hasPrivilege(PrivilegeType.MODIFY, this.grantEntity); } /** Checks the write privilege grant for wrapped grantEntity - * + * * @return true on write privilege grant for wrapped grantEntity */ public boolean w() { return hasPrivilege(PrivilegeType.WRITE, this.grantEntity);