From 1935ac8673c476e45016cc60591e70074ddc7d6b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 7 Feb 2017 14:46:57 +0100 Subject: [PATCH] SONAR-8716 Simplify CeUserSession --- .../java/org/sonar/ce/user/CeUserSession.java | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java b/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java index aeffd092e66..4f163425418 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java @@ -37,89 +37,85 @@ public class CeUserSession implements UserSession { @Override public String getLogin() { - return notImplemented(); + throw notImplemented(); } @Override public String getName() { - return notImplemented(); + throw notImplemented(); } @Override public Integer getUserId() { - return notImplemented(); + throw notImplemented(); } @Override public Collection getGroups() { - return notImplemented(); + throw notImplemented(); } @Override public boolean isLoggedIn() { - return notImplementedBooleanMethod(); + throw notImplemented(); } @Override public boolean isRoot() { - return notImplementedBooleanMethod(); + throw notImplemented(); } @Override public UserSession checkIsRoot() { - return notImplemented(); + throw notImplemented(); } @Override public UserSession checkLoggedIn() { - return notImplemented(); + throw notImplemented(); } @Override public boolean hasPermission(String globalPermission) { - return notImplementedBooleanMethod(); + throw notImplemented(); } @Override public boolean hasOrganizationPermission(String organizationUuid, String permission) { - return notImplementedBooleanMethod(); + throw notImplemented(); } @Override public UserSession checkOrganizationPermission(String organizationUuid, String permission) { - return notImplemented(); + throw notImplemented(); } @Override public List globalPermissions() { - return notImplemented(); + throw notImplemented(); } @Override public UserSession checkComponentPermission(String projectPermission, ComponentDto component) { - return notImplemented(); + throw notImplemented(); } @Override public UserSession checkComponentUuidPermission(String permission, String componentUuid) { - return notImplemented(); + throw notImplemented(); } @Override public boolean hasComponentPermission(String permission, ComponentDto component) { - return notImplementedBooleanMethod(); + throw notImplemented(); } @Override public boolean hasComponentUuidPermission(String permission, String componentUuid) { - return notImplementedBooleanMethod(); + throw notImplemented(); } - private static T notImplemented() { - throw new UnsupportedOperationException(UOE_MESSAGE); - } - - private static boolean notImplementedBooleanMethod() { + private static RuntimeException notImplemented() { throw new UnsupportedOperationException(UOE_MESSAGE); } } -- 2.39.5