Skip to content

Commit 3f78c6f

Browse files
committed
Fix some issues detected by FindBugs.
1 parent 63d075e commit 3f78c6f

File tree

11 files changed

+28
-21
lines changed

11 files changed

+28
-21
lines changed

src/main/java/com/github/theholywaffle/teamspeak3/api/wrapper/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public int[] getServerGroups() {
102102
final String[] arr = str.split(",");
103103
final int[] groups = new int[arr.length];
104104
for (int i = 0; i < groups.length; i++) {
105-
groups[i] = Integer.valueOf(arr[i]);
105+
groups[i] = Integer.parseInt(arr[i]);
106106
}
107107
return groups;
108108
}

src/main/java/com/github/theholywaffle/teamspeak3/api/wrapper/ClientInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public int getDefaultChannel() {
7272
// TeamSpeak decided to prefix the channel ID with a forward slash (/)...
7373
final String channelId = get(ClientProperty.CLIENT_DEFAULT_CHANNEL);
7474
if (channelId.isEmpty()) return -1;
75-
return Integer.valueOf(channelId.substring(1));
75+
return Integer.parseInt(channelId.substring(1));
7676
}
7777

7878
public String getDefaultToken() {

src/main/java/com/github/theholywaffle/teamspeak3/api/wrapper/Wrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public long getLong(String propertyName) {
134134
if (value == null || value.isEmpty()) {
135135
return -1L;
136136
}
137-
return Long.valueOf(value);
137+
return Long.parseLong(value);
138138
}
139139

140140
/**
@@ -164,7 +164,7 @@ public int getInt(String propertyName) {
164164
if (value == null || value.isEmpty()) {
165165
return -1;
166166
}
167-
return Integer.valueOf(value);
167+
return Integer.parseInt(value);
168168
}
169169

170170
/**

src/main/java/com/github/theholywaffle/teamspeak3/commands/CChannelCreate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ public CChannelCreate(String name, Map<ChannelProperty, String> options) {
3838
add(new KeyValueParam("channel_name", name));
3939

4040
if (options != null) {
41-
for (final ChannelProperty p : options.keySet()) {
41+
for (Map.Entry<ChannelProperty, String> option : options.entrySet()) {
42+
final ChannelProperty p = option.getKey();
4243
if (!p.isChangeable()) {
4344
throw new IllegalArgumentException("ChannelProperty " + p.getName() + " is not changeable!");
4445
}
4546

46-
add(new KeyValueParam(p.getName(), options.get(p)));
47+
add(new KeyValueParam(p.getName(), option.getValue()));
4748
}
4849
}
4950
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/CChannelEdit.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ public CChannelEdit(int channelId, Map<ChannelProperty, String> options) {
3838
add(new KeyValueParam("cid", channelId));
3939

4040
if (options != null) {
41-
for (final ChannelProperty p : options.keySet()) {
41+
for (Map.Entry<ChannelProperty, String> option : options.entrySet()) {
42+
final ChannelProperty p = option.getKey();
4243
if (!p.isChangeable()) {
4344
throw new IllegalArgumentException("ChannelProperty " + p.getName() + " is not changeable!");
4445
}
4546

46-
add(new KeyValueParam(p.getName(), options.get(p)));
47+
add(new KeyValueParam(p.getName(), option.getValue()));
4748
}
4849
}
4950
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/CClientDBEdit.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ public CClientDBEdit(int clientDBId, Map<ClientProperty, String> options) {
3838
add(new KeyValueParam("cldbid", clientDBId));
3939

4040
if (options != null) {
41-
for (final ClientProperty p : options.keySet()) {
41+
for (Map.Entry<ClientProperty, String> option : options.entrySet()) {
42+
final ClientProperty p = option.getKey();
4243
if (!p.isChangeable()) {
4344
throw new IllegalArgumentException("ClientProperty " + p.getName() + " is not changeable!");
4445
}
4546

46-
add(new KeyValueParam(p.getName(), options.get(p)));
47+
add(new KeyValueParam(p.getName(), option.getValue()));
4748
}
4849
}
4950
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/CClientEdit.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ public CClientEdit(int clientId, Map<ClientProperty, String> options) {
3838
add(new KeyValueParam("clid", clientId));
3939

4040
if (options != null) {
41-
for (final ClientProperty p : options.keySet()) {
41+
for (Map.Entry<ClientProperty, String> option : options.entrySet()) {
42+
final ClientProperty p = option.getKey();
4243
if (!p.isChangeable()) {
4344
throw new IllegalArgumentException("ClientProperty " + p.getName() + " is not changeable!");
4445
}
4546

46-
add(new KeyValueParam(p.getName(), options.get(p)));
47+
add(new KeyValueParam(p.getName(), option.getValue()));
4748
}
4849
}
4950
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/CClientUpdate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ public CClientUpdate(Map<ClientProperty, String> options) {
3737
super("clientupdate");
3838

3939
if (options != null) {
40-
for (final ClientProperty p : options.keySet()) {
40+
for (Map.Entry<ClientProperty, String> option : options.entrySet()) {
41+
final ClientProperty p = option.getKey();
4142
if (!p.isChangeable()) {
4243
throw new IllegalArgumentException("ClientProperty " + p.getName() + " is not changeable!");
4344
}
4445

45-
add(new KeyValueParam(p.getName(), options.get(p)));
46+
add(new KeyValueParam(p.getName(), option.getValue()));
4647
}
4748
}
4849
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/CServerCreate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ public CServerCreate(String name, Map<VirtualServerProperty, String> map) {
3838
add(new KeyValueParam(VirtualServerProperty.VIRTUALSERVER_NAME.getName(), name));
3939

4040
if (map != null) {
41-
for (final VirtualServerProperty p : map.keySet()) {
41+
for (Map.Entry<VirtualServerProperty, String> option : map.entrySet()) {
42+
final VirtualServerProperty p = option.getKey();
4243
if (!p.isChangeable()) {
4344
throw new IllegalArgumentException("VirtualServerProperty " + p.getName() + " is not changeable!");
4445
}
4546

46-
add(new KeyValueParam(p.getName(), map.get(p)));
47+
add(new KeyValueParam(p.getName(), option.getValue()));
4748
}
4849
}
4950

src/main/java/com/github/theholywaffle/teamspeak3/commands/CServerEdit.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ public class CServerEdit extends Command {
3636
public CServerEdit(Map<VirtualServerProperty, String> map) {
3737
super("serveredit");
3838

39-
for (final VirtualServerProperty p : map.keySet()) {
39+
for (Map.Entry<VirtualServerProperty, String> option : map.entrySet()) {
40+
final VirtualServerProperty p = option.getKey();
4041
if (!p.isChangeable()) {
4142
throw new IllegalArgumentException("VirtualServerProperty " + p.getName() + " is not changeable!");
4243
}
4344

44-
add(new KeyValueParam(p.getName(), map.get(p)));
45+
add(new KeyValueParam(p.getName(), option.getValue()));
4546
}
4647
}
4748
}

0 commit comments

Comments
 (0)