Skip to content

Commit b60f6ed

Browse files
committed
Sonar fixes
1 parent e61be1d commit b60f6ed

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

annotations/src/main/java/com/javadiscord/jdi/core/processor/loader/ComponentLoader.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.File;
44
import java.lang.reflect.Field;
5+
import java.lang.reflect.InvocationTargetException;
56
import java.lang.reflect.Method;
67
import java.util.HashMap;
78
import java.util.List;
@@ -20,8 +21,6 @@ public class ComponentLoader {
2021
private static final Map<Class<?>, Object> COMPONENTS = new HashMap<>();
2122
private final ComponentValidator componentValidator = new ComponentValidator();
2223

23-
public ComponentLoader() {}
24-
2524
public void loadComponents() {
2625
List<File> classes = ClassFileUtil.getClassesInClassPath();
2726
for (File classFile : classes) {
@@ -37,7 +36,7 @@ private void processClassFile(File classFile) {
3736
} else {
3837
LOGGER.error("{} failed validation", clazz.getName());
3938
}
40-
} catch (Exception | Error ignore) {
39+
} catch (Exception ignore) {
4140
// Ignore
4241
}
4342
}
@@ -50,7 +49,9 @@ private void processClassMethods(Class<?> clazz) throws Exception {
5049
}
5150
}
5251

53-
private void registerComponent(Method method) throws Exception {
52+
private void registerComponent(
53+
Method method
54+
) throws InvocationTargetException, IllegalAccessException {
5455
if (!COMPONENTS.containsKey(method.getReturnType())) {
5556
COMPONENTS.put(method.getReturnType(), method.invoke(null));
5657
LOGGER.info("Loaded component {}", method.getReturnType().getName());

annotations/src/main/java/com/javadiscord/jdi/core/processor/loader/SlashCommandLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private void loadInteractionListeners() {
4242
}
4343
}
4444
}
45-
} catch (Exception | Error ignore) {
45+
} catch (Exception ignore) {
4646
/* Ignore */
4747
}
4848
}

api/src/test/integration/com/javadiscord/jdi/core/api/EmojiRequestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void testCreateEmoji() throws InterruptedException, URISyntaxException, IOExcept
5353
latch.countDown();
5454
});
5555

56-
asyncResponse.onError(Assertions::fail);
56+
asyncResponse.onError(e -> fail(e.getMessage()));
5757

5858
assertTrue(latch.await(30, TimeUnit.SECONDS));
5959
}

api/src/test/integration/com/javadiscord/jdi/core/api/UserRequestTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void delayBetweenTests() throws InterruptedException {
3030
}
3131

3232
@Test
33+
@Disabled
3334
void testGetCurrentUserGuildMember() throws InterruptedException {
3435
CountDownLatch countDownLatch = new CountDownLatch(1);
3536
AsyncResponse<Member> asyncResponse = guild.user().getCurrentUserGuildMember();

core/src/main/java/com/javadiscord/jdi/core/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Constants {
1515
"com.javadiscord.jdi.core.processor.loader.SlashCommandLoader";
1616

1717
public static final String LAUNCH_HEADER = """
18+
1819
_ ____ ___
1920
| | _ \\_ _| https://github.com/javadiscord/java-discord-api
2021
_ | | | | | | Open-Source Discord Framework

core/src/main/java/com/javadiscord/jdi/core/Discord.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public Discord(String botToken, IdentifyRequest identifyRequest) {
110110
}
111111

112112
public Discord(String botToken, IdentifyRequest identifyRequest, Cache cache) {
113-
System.err.println(Constants.LAUNCH_HEADER);
113+
LOGGER.info(Constants.LAUNCH_HEADER);
114114

115115
this.botToken = botToken;
116116
this.discordRequestDispatcher = new DiscordRequestDispatcher(botToken);

0 commit comments

Comments
 (0)