Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed debug message #253

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/main/java/com/seailz/discordjar/model/guild/Guild.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@

@NotNull
public static Guild decompile(JSONObject obj, DiscordJar discordJar, boolean bypassCache) {
System.out.println("decomp guild");

// If the cache happens to contain the current guild, we'll use that instead of creating a new one.
// Helpful for slight memory optimization & performance.
Guild cachedGuild = discordJar.getGuildCache().returnFromCache(obj.getString("id"));
Expand Down Expand Up @@ -558,7 +556,7 @@
}

try {
features = GuildFeature.getGuildFeatures(obj.getJSONArray("features").toList().toArray(new String[0]));

Check warning on line 559 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Suspicious 'Collection.toArray()' call

Array of type 'java.lang.Object\[\]' expected, 'java.lang.String\[\]' found
} catch (JSONException e) {
features = null;
}
Expand Down Expand Up @@ -642,9 +640,9 @@
}

try {
approximateMemberCount = obj.getInt("approximate_member_count");

Check warning on line 643 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

The value `obj.getInt("approximate_member_count")` assigned to `approximateMemberCount` is never used
} catch (JSONException e) {
approximateMemberCount = 0;

Check warning on line 645 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

The value `0` assigned to `approximateMemberCount` is never used
}

try {
Expand Down Expand Up @@ -731,7 +729,7 @@
JsonCache.newc(new DiscordRequest(
new JSONObject(),
new HashMap<>(),
URLS.GET.GUILDS.ROLES.GET_GUILD_ROLES.replace("{guild.id}", id),

Check warning on line 732 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Argument `id` might be null
discordJar,
URLS.GET.GUILDS.ROLES.GET_GUILD_ROLES,
RequestMethod.GET
Expand Down Expand Up @@ -966,7 +964,7 @@
public List<Member> getMembers(int limit, String after) {
Checker.check(limit <= 0, "Limit must be greater than 0");
Checker.check(limit > 1000, "Limit must be less than or equal to 1000");
JSONArray arr = null;

Check warning on line 967 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

Variable `arr` initializer `null` is redundant
try {
arr = new DiscordRequest(
new JSONObject(),
Expand All @@ -992,7 +990,7 @@
}

public List<Member> getMembers() {
JSONArray arr = null;

Check warning on line 993 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

Variable `arr` initializer `null` is redundant
try {
arr = new DiscordRequest(
new JSONObject(),
Expand Down Expand Up @@ -1079,7 +1077,7 @@
@NotNull
public List<GuildChannel> getChannels() {
List<GuildChannel> channels = new ArrayList<>();
DiscordResponse req = null;

Check warning on line 1080 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

Variable `req` initializer `null` is redundant
try {
req = new DiscordRequest(
new JSONObject(),
Expand Down Expand Up @@ -1112,7 +1110,7 @@
public List<Role> roles() {
if (roleCache != null && !roleCache.isEmpty()) {
List<Role> roles = new ArrayList<>();
roleCache.get().getJSONArray("data").forEach(

Check warning on line 1113 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Method invocation `getJSONArray` may produce `NullPointerException`
o -> roles.add(Role.decompile((JSONObject) o))
);
return roles;
Expand All @@ -1128,7 +1126,7 @@
RequestMethod.GET
);
JSONArray res;
DiscordResponse response = null;

Check warning on line 1129 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused assignment

Variable `response` initializer `null` is redundant
try {
response = req.invoke();
res = response.arr();
Expand All @@ -1139,7 +1137,7 @@
System.out.println(response.code() + " " + (response.body() == null ? "null" : response.body().toString()));
}

res.forEach(o -> roles.add(Role.decompile((JSONObject) o)));

Check warning on line 1140 in src/main/java/com/seailz/discordjar/model/guild/Guild.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Method invocation `forEach` may produce `NullPointerException`

if (roleCache != null) {
roleCache.update(new JSONObject().put("data", res));
Expand Down
Loading