Permalink
Browse files

Enable findbugs and PMD

  • Loading branch information...
1 parent 0d52c18 commit 3a9069990e6f95c5ffcc4452bc675f93a0976307 @andrewcox andrewcox committed Feb 28, 2013
View
@@ -16,14 +16,16 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>com.facebook.nifty</groupId>
- <artifactId>nifty-parent</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
+ <groupId>com.facebook.nifty</groupId>
+ <artifactId>nifty-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
<name>Nifty client</name>
@@ -35,53 +37,53 @@ limitations under the License.
</properties>
<dependencies>
- <dependency>
- <groupId>com.facebook.nifty</groupId>
- <artifactId>nifty-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.airlift</groupId>
- <artifactId>units</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>com.facebook.nifty</groupId>
+ <artifactId>nifty-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.airlift</groupId>
+ <artifactId>units</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
@@ -337,7 +337,7 @@ public void run(Timeout timeout) {
/**
* Used to create TimerTasks that will fire
*/
- private class IoThreadBoundTimerTask implements TimerTask {
+ private static class IoThreadBoundTimerTask implements TimerTask {
private final NiftyClientChannel channel;
private final TimerTask timerTask;
@@ -141,6 +141,8 @@ else if (e instanceof ChannelStateEvent) {
listener.onChannelClosedOrDisconnected(ctx.getChannel());
}
break;
+ default:
+ break;
}
}
else if (e instanceof ExceptionEvent) {
@@ -152,10 +154,8 @@ else if (e instanceof ExceptionEvent) {
private void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
{
- if (e.getMessage() instanceof ChannelBuffer) {
- if (listener != null) {
- listener.onFrameRead(ctx.getChannel(), (ChannelBuffer) e.getMessage());
- }
+ if (e.getMessage() instanceof ChannelBuffer && listener != null) {
+ listener.onFrameRead(ctx.getChannel(), (ChannelBuffer) e.getMessage());
}
// drop it
}
@@ -15,6 +15,7 @@
*/
package com.facebook.nifty.client.socks;
+import com.google.common.base.Charsets;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@@ -40,7 +41,7 @@ public static ChannelBuffer createSocks4packet(InetAddress address, int port)
if (address == null) {
throw new IllegalArgumentException("address is null");
}
- byte[] userBytes = System.getProperty("user.name", "").getBytes();
+ byte[] userBytes = System.getProperty("user.name", "").getBytes(Charsets.ISO_8859_1);
ChannelBuffer handshake = ChannelBuffers.dynamicBuffer(9 + userBytes.length);
handshake.writeByte(SOCKS_VERSION_4); // SOCKS version
handshake.writeByte(CONNECT); // CONNECT
@@ -56,8 +57,8 @@ public static ChannelBuffer createSock4aPacket(String hostName, int port)
if (hostName == null) {
throw new IllegalArgumentException("hostName is null");
}
- byte[] userBytes = System.getProperty("user.name", "").getBytes();
- byte[] hostNameBytes = hostName.getBytes();
+ byte[] userBytes = System.getProperty("user.name", "").getBytes(Charsets.ISO_8859_1);
+ byte[] hostNameBytes = hostName.getBytes(Charsets.ISO_8859_1);
ChannelBuffer handshake = ChannelBuffers.dynamicBuffer(10 + userBytes.length + hostNameBytes.length);
handshake.writeByte(SOCKS_VERSION_4); // SOCKS version
handshake.writeByte(CONNECT); // CONNECT
View
@@ -16,13 +16,15 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>com.facebook.nifty</groupId>
- <artifactId>nifty-parent</artifactId>
- <version>0.6.0-SNAPSHOT</version>
+ <groupId>com.facebook.nifty</groupId>
+ <artifactId>nifty-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
</parent>
<name>Nifty Core</name>
@@ -34,52 +36,52 @@ limitations under the License.
</properties>
<dependencies>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.airlift</groupId>
- <artifactId>units</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.airlift</groupId>
+ <artifactId>units</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Oops, something went wrong.

0 comments on commit 3a90699

Please sign in to comment.