From e2b5991c7ef33ee3ac6483ca00e3e854bb935371 Mon Sep 17 00:00:00 2001 From: Hiroyuki Wada Date: Sat, 2 Nov 2024 14:43:53 +0900 Subject: [PATCH] fix: eliminate the possibility of NullPointerException (#56) * fix: eliminate the possibility of NullPointerException * build: fix release build --------- Co-authored-by: Ryan Peper --- .releaserc | 2 +- pom.xml | 7 +++++++ .../keycloak/social/discord/DiscordIdentityProvider.java | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.releaserc b/.releaserc index a8a9deb..b58cdd4 100644 --- a/.releaserc +++ b/.releaserc @@ -9,7 +9,7 @@ [ "@terrestris/maven-semantic-release", { - "mavenTarget": "install", + "mavenTarget": "deploy", "clean": false, "updateSnapshotVersion": true, "settingsPath": "/home/runner/.m2/settings.xml", diff --git a/pom.xml b/pom.xml index 2c0de7b..7ff093d 100755 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,13 @@ 17 + + maven-deploy-plugin + 3.1.3 + + true + + diff --git a/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java b/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java index 4659183..b14fc3e 100755 --- a/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java +++ b/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java @@ -71,9 +71,11 @@ protected BrokeredIdentityContext extractIdentityFromProfile(EventBuilder event, String username = getJsonProperty(profile, "username"); String discriminator = getJsonProperty(profile, "discriminator"); - if (!discriminator.equals("0")) { - username = username + "#" + discriminator; + + if (!"0".equals(discriminator)) { + username += "#" + discriminator; } + user.setUsername(username); user.setEmail(getJsonProperty(profile, "email")); user.setIdp(this);