[hornetq-commits] JBoss hornetq SVN: r12171 - in trunk: hornetq-core/src/main/java/org/hornetq/core/filter/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Feb 23 04:38:28 EST 2012


Author: borges
Date: 2012-02-23 04:38:28 -0500 (Thu, 23 Feb 2012)
New Revision: 12171

Modified:
   trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
   trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java
Log:
Add default case to switch statement.

Modified: trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
===================================================================
--- trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java	2012-02-23 09:38:04 UTC (rev 12170)
+++ trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java	2012-02-23 09:38:28 UTC (rev 12171)
@@ -19,19 +19,24 @@
 import org.hornetq.core.logging.Logger;
 
 /**
- * 
+ *
  * A UTF8Util
- * 
+ *
  * This class will write UTFs directly to the ByteOutput (through the MessageBuffer interface)
  *
  * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * 
+ *
  * Created Feb 20, 2009 1:37:18 PM
  *
  *
  */
-public class UTF8Util
+public final class UTF8Util
 {
+   private UTF8Util()
+   {
+      // utility class
+   }
+
    static boolean optimizeStrings = true;
 
    private static final Logger log = Logger.getLogger(UTF8Util.class);
@@ -100,7 +105,6 @@
             {
                buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
                buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
-
             }
          }
          out.writeBytes(buffer.byteBuffer, 0, len);
@@ -158,6 +162,8 @@
                   byte3 = buffer.byteBuffer[count++];
                   buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
                   break;
+               default:
+                  throw new InternalError("unhandled utf8 byte " + c);
             }
          }
       }

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java	2012-02-23 09:38:04 UTC (rev 12170)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java	2012-02-23 09:38:28 UTC (rev 12171)
@@ -36,7 +36,7 @@
 * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
 * @version $Revision: 2681 $
 */
-public class Operator
+public final class Operator
 {
    int operation;
 
@@ -1293,9 +1293,9 @@
             return in();
          case NOT_IN:
             return not_in();
+         default:
+            throw new IllegalArgumentException("No operation mapped to int " + operation);
       }
-
-      throw new Exception("Unknown operation: " + toString());
    }
 
    public void throwBadObjectException(final Class class1) throws Exception



More information about the hornetq-commits mailing list