mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[ANY] Исправление ошибок, найденных PVS-Studio
This commit is contained in:
parent
e0113ac595
commit
65d5608efd
9 changed files with 23 additions and 28 deletions
|
@ -130,7 +130,7 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
|||
}
|
||||
if (server.config.protectHandler.allowGetAccessToken(context)) {
|
||||
UUID uuid = pair.handler.auth(aresult);
|
||||
result.playerProfile = ProfileByUUIDResponse.getProfile(server, uuid, aresult.username, client, clientData.auth.textureProvider);
|
||||
result.playerProfile = ProfileByUUIDResponse.getProfile(uuid, aresult.username, client, clientData.auth.textureProvider);
|
||||
LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString());
|
||||
}
|
||||
sendResult(result);
|
||||
|
|
|
@ -26,7 +26,7 @@ public void execute(ChannelHandlerContext ctx, Client pClient) {
|
|||
server.authHookManager.checkServerHook.hook(this, pClient);
|
||||
result.uuid = pClient.auth.handler.checkServer(username, serverID);
|
||||
if (result.uuid != null)
|
||||
result.playerProfile = ProfileByUUIDResponse.getProfile(server, result.uuid, username, client, pClient.auth.textureProvider);
|
||||
result.playerProfile = ProfileByUUIDResponse.getProfile(result.uuid, username, client, pClient.auth.textureProvider);
|
||||
LogHelper.debug("checkServer: %s uuid: %s serverID: %s", result.playerProfile.username, result.uuid.toString(), serverID);
|
||||
} catch (AuthException | HookException e) {
|
||||
sendError(e.getMessage());
|
||||
|
|
|
@ -32,7 +32,7 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
|||
LogHelper.warning("Client auth is null. Using default.");
|
||||
uuid = server.config.getAuthProviderPair().handler.usernameToUUID(list[i].username);
|
||||
} else uuid = client.auth.handler.usernameToUUID(list[i].username);
|
||||
result.playerProfiles[i] = ProfileByUUIDResponse.getProfile(server, uuid, list[i].username, list[i].client, client.auth.textureProvider);
|
||||
result.playerProfiles[i] = ProfileByUUIDResponse.getProfile(uuid, list[i].username, list[i].client, client.auth.textureProvider);
|
||||
}
|
||||
sendResult(result);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import pro.gravit.launcher.events.request.ProfileByUUIDRequestEvent;
|
||||
import pro.gravit.launcher.profiles.PlayerProfile;
|
||||
import pro.gravit.launcher.profiles.Texture;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||
|
@ -17,7 +17,7 @@ public class ProfileByUUIDResponse extends SimpleResponse {
|
|||
public UUID uuid;
|
||||
public String client;
|
||||
|
||||
public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client, TextureProvider textureProvider) {
|
||||
public static PlayerProfile getProfile(UUID uuid, String username, String client, TextureProvider textureProvider) {
|
||||
// Get skin texture
|
||||
Texture skin;
|
||||
try {
|
||||
|
@ -48,10 +48,19 @@ public String getType() {
|
|||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
String username;
|
||||
AuthProviderPair pair;
|
||||
if (client.auth == null) {
|
||||
LogHelper.warning("Client auth is null. Using default.");
|
||||
username = server.config.getAuthProviderPair().handler.uuidToUsername(uuid);
|
||||
} else username = client.auth.handler.uuidToUsername(uuid);
|
||||
sendResult(new ProfileByUUIDRequestEvent(getProfile(server, uuid, username, this.client, client.auth.textureProvider)));
|
||||
pair = server.config.getAuthProviderPair();
|
||||
} else {
|
||||
pair = client.auth;
|
||||
}
|
||||
if(pair == null)
|
||||
{
|
||||
sendError("ProfileByUUIDResponse: AuthProviderPair is null");
|
||||
return;
|
||||
}
|
||||
username = pair.handler.uuidToUsername(uuid);
|
||||
sendResult(new ProfileByUUIDRequestEvent(getProfile(uuid, username, this.client, client.auth.textureProvider)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
|||
LogHelper.warning("Client auth is null. Using default.");
|
||||
uuid = server.config.getAuthProviderPair().handler.usernameToUUID(username);
|
||||
} else uuid = client.auth.handler.usernameToUUID(username);
|
||||
sendResult(new ProfileByUsernameRequestEvent(ProfileByUUIDResponse.getProfile(server, uuid, username, this.client, client.auth.textureProvider)));
|
||||
sendResult(new ProfileByUsernameRequestEvent(ProfileByUUIDResponse.getProfile(uuid, username, this.client, client.auth.textureProvider)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,6 @@ public String getHWDisk() {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSoundCardInfo() {
|
||||
for (SoundCard soundcard : hardware.getSoundCards()) {
|
||||
return soundcard.getName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getMacAddr() {
|
||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
||||
|
@ -119,9 +112,6 @@ public void printHardwareInformation() {
|
|||
LogHelper.subDebug("IPv4: %s", ipv4);
|
||||
}
|
||||
}
|
||||
for (SoundCard soundcard : hardware.getSoundCards()) {
|
||||
LogHelper.debug("SoundCard %s", soundcard.getName());
|
||||
}
|
||||
CentralProcessor processor = hardware.getProcessor();
|
||||
LogHelper.debug("Processor Model: %s ID: %s", processor.getModel(), processor.getProcessorID());
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
@ -30,7 +29,7 @@ public class ClientWebSocketService extends ClientJSONPoint {
|
|||
public static ProviderMap<WebSocketRequest> requests = new ProviderMap<>();
|
||||
private HashSet<EventHandler> handlers;
|
||||
|
||||
public ClientWebSocketService(String address, int i) throws SSLException {
|
||||
public ClientWebSocketService(String address) throws SSLException {
|
||||
super(createURL(address));
|
||||
handlers = new HashSet<>();
|
||||
this.gson = Launcher.gsonManager.gson;
|
||||
|
|
|
@ -7,21 +7,18 @@
|
|||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import pro.gravit.launcher.events.request.ErrorRequestEvent;
|
||||
import pro.gravit.launcher.request.Request;
|
||||
import pro.gravit.launcher.request.RequestException;
|
||||
import pro.gravit.launcher.request.WebSocketEvent;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class StandartClientWebSocketService extends ClientWebSocketService {
|
||||
public WaitEventHandler waitEventHandler = new WaitEventHandler();
|
||||
|
||||
public StandartClientWebSocketService(String address, int i) throws SSLException {
|
||||
super(address, i);
|
||||
public StandartClientWebSocketService(String address) throws SSLException {
|
||||
super(address);
|
||||
}
|
||||
|
||||
public class RequestFuture implements Future<WebSocketEvent> {
|
||||
|
@ -109,7 +106,7 @@ public RequestFuture asyncSendRequest(WebSocketRequest request) throws IOExcepti
|
|||
public static StandartClientWebSocketService initWebSockets(String address, boolean async) {
|
||||
StandartClientWebSocketService service;
|
||||
try {
|
||||
service = new StandartClientWebSocketService(address, 5000);
|
||||
service = new StandartClientWebSocketService(address);
|
||||
} catch (SSLException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit bd42367cf2ecab28b18521a35bcdc0f4f6b7b647
|
||||
Subproject commit 8b32ca34fefc7896a276d91d22c309276128d3a4
|
Loading…
Reference in a new issue