sonar cleanup in Sessionhandler

This commit is contained in:
Ingmar Goudt 2019-03-10 22:04:27 +01:00
parent dab481ee17
commit 7a5920322d

View file

@ -14,6 +14,7 @@ import mage.remote.MageRemoteException;
import mage.remote.Session; import mage.remote.Session;
import mage.remote.SessionImpl; import mage.remote.SessionImpl;
import mage.view.*; import mage.view.*;
import org.apache.log4j.Logger;
import java.util.*; import java.util.*;
@ -22,9 +23,15 @@ import java.util.*;
*/ */
public final class SessionHandler { public final class SessionHandler {
private static final Logger logger = Logger.getLogger(SessionHandler.class);
private static Session session; private static Session session;
private static String lastConnectError = ""; private static String lastConnectError = "";
private SessionHandler(){
}
public static void startSession(MageFrame mageFrame) { public static void startSession(MageFrame mageFrame) {
session = new SessionImpl(mageFrame); session = new SessionImpl(mageFrame);
@ -181,7 +188,7 @@ public final class SessionHandler {
try { try {
return session.getTournament(tournamentId); return session.getTournament(tournamentId);
} catch (MageRemoteException e) { } catch (MageRemoteException e) {
e.printStackTrace(); logger.info(e);
return null; return null;
} }
@ -275,7 +282,7 @@ public final class SessionHandler {
try { try {
return session.getRoomUsers(roomId); return session.getRoomUsers(roomId);
} catch (MageRemoteException e) { } catch (MageRemoteException e) {
e.printStackTrace(); logger.info(e);
return Collections.emptyList(); return Collections.emptyList();
} }
} }
@ -284,8 +291,8 @@ public final class SessionHandler {
try { try {
return session.getFinishedMatches(roomId); return session.getFinishedMatches(roomId);
} catch (MageRemoteException e) { } catch (MageRemoteException e) {
e.printStackTrace(); logger.info(e);
return new ArrayList<>(); return Collections.emptyList();
} }
} }
@ -301,8 +308,8 @@ public final class SessionHandler {
try { try {
return session.getTables(roomId); return session.getTables(roomId);
} catch (MageRemoteException e) { } catch (MageRemoteException e) {
e.printStackTrace(); logger.info(e);
return new ArrayList<>(); return Collections.emptyList();
} }
} }