Skip to content

Commit

Permalink
Check for empty token in AuthorizationConfig, instead of JDAImpl (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Oct 23, 2022
1 parent 07f412d commit 8520369
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/main/java/net/dv8tion/jda/internal/JDAImpl.java
Expand Up @@ -293,10 +293,7 @@ public int login(String gatewayUrl, ShardInfo shardInfo, Compression compression
this.gatewayUrl = gatewayUrl == null ? getGateway() : gatewayUrl;
Checks.notNull(this.gatewayUrl, "Gateway URL");

String token = authConfig.getToken();
setStatus(Status.LOGGING_IN);
if (token == null || token.isEmpty())
throw new InvalidTokenException("Provided token was null or empty!");

Map<String, String> previousContext = null;
ConcurrentMap<String, String> contextMap = metaConfig.getMdcContextMap();
Expand Down
Expand Up @@ -27,7 +27,8 @@ public final class AuthorizationConfig

public AuthorizationConfig(@Nonnull String token)
{
Checks.notNull(token, "Token");
Checks.notEmpty(token, "Token");
Checks.noWhitespace(token, "Token");
setToken(token);
}

Expand Down

0 comments on commit 8520369

Please sign in to comment.