From 7226e199e5eeaa4940e176d787d3e90c92e2c906 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 18 Jul 2015 21:35:00 -0400 Subject: [PATCH] A few build improvements --- .travis.yml | 2 +- ProtocolLib/pom.xml | 8 ++++---- .../compat/netty/independent/IndependentNetty.java | 7 ++----- .../comphenix/protocol/events/PacketContainerTest.java | 8 +++++--- .../protocol/compat/netty/shaded/ShadedNetty.java | 7 ++----- pom.xml | 4 ++-- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbc933c0..bf98c564 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ jdk: - oraclejdk8 - oraclejdk7 - openjdk6 -script: mvn clean install -U +script: mvn clean test -U before_install: cd ProtocolLib install: true notifications: diff --git a/ProtocolLib/pom.xml b/ProtocolLib/pom.xml index 05b1b6ab..8083d5f8 100644 --- a/ProtocolLib/pom.xml +++ b/ProtocolLib/pom.xml @@ -90,7 +90,7 @@ - + - + diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java index 49f2eaf1..5fcef282 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/compat/netty/independent/IndependentNetty.java @@ -45,14 +45,11 @@ public class IndependentNetty implements NettyCompat { @Override public WrappedByteBuf createPacketBuffer() { - return getPacketDataSerializer(UnpooledByteBufAllocator.DEFAULT.buffer()); - } - - private WrappedByteBuf getPacketDataSerializer(ByteBuf buffer) { + ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer(); Class packetSerializer = MinecraftReflection.getPacketDataSerializerClass(); try { - return new NettyByteBuf((ByteBuf) packetSerializer.getConstructor(MinecraftReflection.getByteBufClass()).newInstance(buffer)); + return new NettyByteBuf((ByteBuf) packetSerializer.getConstructor(ByteBuf.class).newInstance(buffer)); } catch (Exception e) { throw new RuntimeException("Cannot construct packet serializer.", e); } diff --git a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java index c18e8472..5e64c863 100644 --- a/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java +++ b/ProtocolLib/src/test/java/com/comphenix/protocol/events/PacketContainerTest.java @@ -371,9 +371,11 @@ public class PacketContainerTest { assertEquals(PacketType.Play.Client.CHAT, copy.getType()); assertEquals("Test", copy.getStrings().read(0)); - } catch (NullPointerException ex) { - // This occurs intermittently with Java 6, just log it and move on - System.err.println("Encountered a NullPointerException with serialization"); + } catch (Throwable ex) { + // This occurs intermittently on Java 6, for the time being just log it and move on + // TODO: Possibly find a solution to this + System.err.println("Failed to serialize packet:"); + ex.printStackTrace(); } } diff --git a/modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedNetty.java b/modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedNetty.java index 18d65ca9..a225fccb 100644 --- a/modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedNetty.java +++ b/modules/v1_7_R4/src/main/java/com/comphenix/protocol/compat/netty/shaded/ShadedNetty.java @@ -45,14 +45,11 @@ public class ShadedNetty implements NettyCompat { @Override public WrappedByteBuf createPacketBuffer() { - return getPacketDataSerializer(UnpooledByteBufAllocator.DEFAULT.buffer()); - } - - private WrappedByteBuf getPacketDataSerializer(ByteBuf buffer) { + ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer(); Class packetSerializer = MinecraftReflection.getPacketDataSerializerClass(); try { - return new ShadedByteBuf((ByteBuf) packetSerializer.getConstructor(MinecraftReflection.getByteBufClass()).newInstance(buffer)); + return new ShadedByteBuf((ByteBuf) packetSerializer.getConstructor(ByteBuf.class).newInstance(buffer)); } catch (Exception e) { throw new RuntimeException("Cannot construct packet serializer.", e); } diff --git a/pom.xml b/pom.xml index 93d96ce7..2643442e 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ - + \ No newline at end of file