From 3db26bff365de7d2d4e7fc45ad31b8104c78a0ae Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 25 Mar 2008 05:38:00 +0000 Subject: Fixes for bugs as reported by FindBugs. --- src/main/java/com/amazon/carbonado/raw/DataEncoder.java | 9 ++------- src/main/java/com/amazon/carbonado/raw/KeyEncoder.java | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/raw') diff --git a/src/main/java/com/amazon/carbonado/raw/DataEncoder.java b/src/main/java/com/amazon/carbonado/raw/DataEncoder.java index 1049644..6eebc93 100644 --- a/src/main/java/com/amazon/carbonado/raw/DataEncoder.java +++ b/src/main/java/com/amazon/carbonado/raw/DataEncoder.java @@ -44,11 +44,6 @@ public class DataEncoder { /** Byte to use for not-null, high ordering */ static final byte NOT_NULL_BYTE_LOW = (byte)~NOT_NULL_BYTE_HIGH; - static final byte[] NULL_BYTE_ARRAY_HIGH = {NULL_BYTE_HIGH}; - static final byte[] NULL_BYTE_ARRAY_LOW = {NULL_BYTE_LOW}; - static final byte[] NOT_NULL_BYTE_ARRAY_HIGH = {NOT_NULL_BYTE_HIGH}; - static final byte[] NOT_NULL_BYTE_ARRAY_LOW = {NOT_NULL_BYTE_LOW}; - /** * Encodes the given signed integer into exactly 4 bytes. * @@ -604,12 +599,12 @@ public class DataEncoder { public static byte[] encodeSingleNullable(byte[] value, int prefixPadding, int suffixPadding) { if (prefixPadding <= 0 && suffixPadding <= 0) { if (value == null) { - return NULL_BYTE_ARRAY_HIGH; + return new byte[] {NULL_BYTE_HIGH}; } int length = value.length; if (length == 0) { - return NOT_NULL_BYTE_ARRAY_HIGH; + return new byte[] {NOT_NULL_BYTE_HIGH}; } byte[] dst = new byte[1 + length]; diff --git a/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java b/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java index 44c5af5..5b11586 100644 --- a/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java +++ b/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java @@ -708,12 +708,12 @@ public class KeyEncoder extends DataEncoder { int prefixPadding, int suffixPadding) { if (prefixPadding <= 0 && suffixPadding <= 0) { if (value == null) { - return NULL_BYTE_ARRAY_LOW; + return new byte[] {NULL_BYTE_LOW}; } int length = value.length; if (length == 0) { - return NOT_NULL_BYTE_ARRAY_LOW; + return new byte[] {NOT_NULL_BYTE_LOW}; } byte[] dst = new byte[1 + length]; -- cgit v1.2.3