// Copyright (c) 2006- Facebook
// Distributed under the Thrift Software License
//
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/

package com.facebook.thrift.protocol;

import com.facebook.thrift.TException;
import com.facebook.thrift.transport.TTransport;

/**
 * Utility class with static methods for interacting with protocol data
 * streams.
 *
 * @author Mark Slee <mcslee@facebook.com>
 */
public class TProtocolUtil {
  public static void skip(TProtocol prot, byte type)
    throws TException {

    switch (type) {
    case TType.BOOL:
      {
        prot.readBool();
      }
    case TType.BYTE:
      {
        prot.readByte();
      }
    case TType.I16:
      {
        prot.readI16();
      }
    case TType.I32:
      {
        prot.readI32();
      }
    case TType.I64:
      {
        prot.readI64();
      }
    case TType.DOUBLE:
      {
        prot.readDouble();
      }
    case TType.STRING:
      {
        prot.readString();
      }
    case TType.STRUCT:
      {
        prot.readStructBegin();
        while (true) {
          TField field = prot.readFieldBegin();
          if (field.type == TType.STOP) {
            break;
          }
          skip(prot, field.type);
          prot.readFieldEnd();
        }
        prot.readStructEnd();
      }
    case TType.MAP:
      {
        TMap map = prot.readMapBegin();
        for (int i = 0; i < map.size; i++) {
          skip(prot, map.keyType);
          skip(prot, map.valueType);
        }
        prot.readMapEnd();
      }
    case TType.SET:
      {        
        TSet set = prot.readSetBegin();
        for (int i = 0; i < set.size; i++) {
          skip(prot, set.elemType);
        }
        prot.readSetEnd();
      }
    case TType.LIST:
      {
        TList list = prot.readListBegin();
        for (int i = 0; i < list.size; i++) {
          skip(prot, list.elemType);
        }
        prot.readListEnd();
      }
    default:
      return;
    }
  }
}

@@ -625,32 +625,47 @@
 readBool();%0A
+        break;%0A
       %7D%0A
     case TTy
@@ -644,32 +644,32 @@
  break;%0A      %7D%0A
-
     case TType.B
@@ -702,24 +702,39 @@
 readByte();%0A
+        break;%0A
       %7D%0A    
@@ -777,24 +777,39 @@
 .readI16();%0A
+        break;%0A
       %7D%0A    
@@ -852,24 +852,39 @@
 .readI32();%0A
+        break;%0A
       %7D%0A    
@@ -927,24 +927,39 @@
 .readI64();%0A
+        break;%0A
       %7D%0A    
@@ -1008,24 +1008,39 @@
 adDouble();%0A
+        break;%0A
       %7D%0A    
@@ -1089,24 +1089,39 @@
 adString();%0A
+        break;%0A
       %7D%0A    
@@ -1420,32 +1420,47 @@
 eadStructEnd();%0A
+        break;%0A
       %7D%0A    case
@@ -1669,24 +1669,39 @@
 adMapEnd();%0A
+        break;%0A
       %7D%0A    
@@ -1882,32 +1882,47 @@
 t.readSetEnd();%0A
+        break;%0A
       %7D%0A    case
@@ -2102,24 +2102,39 @@
 dListEnd();%0A
+        break;%0A
       %7D%0A    
@@ -2152,14 +2152,13 @@
     
+b
 re
-turn
+ak
 ;%0A  

Fix missing break statements in Java ProtocolUtil