diff --git a/pom.xml b/pom.xml
index 3b77c86a..1c051a90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,6 +87,12 @@
3.0.3
compile
+
+ com.google.code.findbugs
+ findbugs
+ 3.0.0
+ provided
+
org.projectlombok
lombok
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index 5a258046..cdbd5b33 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -1,5 +1,6 @@
package net.md_5.bungee;
+import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@@ -16,6 +17,7 @@ import net.md_5.bungee.log.BungeeLogger;
import net.md_5.bungee.scheduler.BungeeScheduler;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gson.Gson;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelException;
@@ -157,6 +159,7 @@ public class BungeeCord extends ProxyServer
return (BungeeCord) ProxyServer.getInstance();
}
+ @SuppressFBWarnings("DM_DEFAULT_ENCODING")
public BungeeCord() throws IOException
{
System.setSecurityManager( new BungeeSecurityManager() );
@@ -200,6 +203,7 @@ public class BungeeCord extends ProxyServer
* @throws Exception
*/
@Override
+ @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
public void start() throws Exception
{
System.setProperty( "java.net.preferIPv4Stack", "true" ); // Minecraft does not support IPv6
@@ -311,6 +315,7 @@ public class BungeeCord extends ProxyServer
new Thread( "Shutdown Thread" )
{
@Override
+ @SuppressFBWarnings("DM_EXIT")
@SuppressWarnings("TooBroadCatch")
public void run()
{
@@ -514,7 +519,7 @@ public class BungeeCord extends ProxyServer
public PluginMessage registerChannels()
{
- return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes() );
+ return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes( Charsets.UTF_8 ) );
}
@Override
@@ -614,7 +619,7 @@ public class BungeeCord extends ProxyServer
@Override
public boolean apply(ProxiedPlayer input)
{
- return input.getName().toLowerCase().contains( partialName.toLowerCase() );
+ return ( input == null ) ? false : input.getName().toLowerCase().contains( partialName.toLowerCase() );
}
} ) );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java b/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java
index 50520b46..2a5ebecf 100644
--- a/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java
+++ b/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java
@@ -24,7 +24,7 @@ public class EncryptionUtil
{
private static final Random random = new Random();
- public static KeyPair keys;
+ public static final KeyPair keys;
@Getter
private static final SecretKey secret = new SecretKeySpec( new byte[ 16 ], "AES" );
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
index 62697e3a..6f0a3297 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -96,7 +96,6 @@ public final class UserConnection implements ProxiedPlayer
@Setter
private int serverEntityId;
@Getter
- @Setter
private ClientSettings settings;
@Getter
private final Scoreboard serverSentScoreboard = new Scoreboard();
@@ -435,9 +434,15 @@ public final class UserConnection implements ProxiedPlayer
return getPendingConnection().getUniqueId();
}
+ public void setSettings(ClientSettings settings)
+ {
+ this.settings = settings;
+ this.locale = null;
+ }
+
@Override
public Locale getLocale()
{
- return ( locale == null ) ? locale = Locale.forLanguageTag( settings.getLocale() ) : locale;
+ return ( locale == null && settings != null ) ? locale = Locale.forLanguageTag( settings.getLocale() ) : locale;
}
}
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
index fca930f6..071cddf0 100644
--- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
+++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
@@ -1,5 +1,6 @@
package net.md_5.bungee.conf;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
@@ -42,19 +43,23 @@ public class YamlConfig implements ConfigurationAdapter
GLOBAL( Global.class ), GLOBAL_PING( GlobalPing.class ), SERVER( ServerUnique.class );
private final Class extends TabListHandler> clazz;
}
- private Yaml yaml;
+ private final Yaml yaml;
private Map config;
private final File file = new File( "config.yml" );
+ public YamlConfig()
+ {
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
+ yaml = new Yaml( options );
+ }
+
@Override
public void load()
{
try
{
file.createNewFile();
- DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
- yaml = new Yaml( options );
try ( InputStream is = new FileInputStream( file ) )
{
@@ -182,6 +187,7 @@ public class YamlConfig implements ConfigurationAdapter
@Override
@SuppressWarnings("unchecked")
+ @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public Collection getListeners()
{
Collection