Fixed a potential OutOfBoundException for byte between 0x80 and 0xFF

git-svn-id: https://svn.apache.org/repos/asf/mina/asyncweb/trunk@904078 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/common/src/main/java/org/apache/asyncweb/common/codec/HttpCodecUtils.java b/common/src/main/java/org/apache/asyncweb/common/codec/HttpCodecUtils.java
index faf111b..b2a91c5 100644
--- a/common/src/main/java/org/apache/asyncweb/common/codec/HttpCodecUtils.java
+++ b/common/src/main/java/org/apache/asyncweb/common/codec/HttpCodecUtils.java
@@ -28,7 +28,6 @@
 
 import org.apache.asyncweb.common.HttpMessage;
 import org.apache.asyncweb.common.HttpResponseStatus;
-import org.apache.asyncweb.common.HttpResponseStatus.Category;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.filter.codec.ProtocolDecoderException;
 import org.slf4j.Logger;
@@ -65,22 +64,23 @@
     /**
      * A lookup table from ASCII char values to corresponding decimal values
      */
-    private static final int[] HEX_DEC = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, 00, 01, 02, 03, 04, 05, 06, 07, 8, 9, -1, -1,
-            -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-            -1, -1, -1, -1, -1, -1, -1, -1, -1, };
+    private static final int[] HEX_DEC = { 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        00, 01, 02, 03, 04, 05, 06, 07,  8,  9, -1, -1, -1, -1, -1, -1, 
+        -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
 
     private static final Logger LOG = LoggerFactory
             .getLogger(HttpCodecUtils.class);
@@ -99,7 +99,7 @@
      *          character
      */
     static boolean isHex(byte b) {
-        return HEX_DEC[b] != -1;
+        return HEX_DEC[b&0x00FF] != -1;
     }
 
     /**
@@ -111,7 +111,7 @@
      *           separator
      */
     public static boolean isHttpSeparator(byte b) {
-        return HTTP_SEPARATORS[b];
+        return HTTP_SEPARATORS[b&0x00FF];
     }
 
     /**
@@ -123,7 +123,7 @@
      *           character
      */
     public static boolean isHttpControl(byte b) {
-        return HTTP_CONTROLS[b];
+        return HTTP_CONTROLS[b&0x00FF];
     }
 
     /**