Example usage for org.apache.thrift TApplicationException UNKNOWN

List of usage examples for org.apache.thrift TApplicationException UNKNOWN

Introduction

In this page you can find the example usage for org.apache.thrift TApplicationException UNKNOWN.

Prototype

int UNKNOWN

To view the source code for org.apache.thrift TApplicationException UNKNOWN.

Click Source Link

Usage

From source file:com.linecorp.armeria.internal.thrift.TApplicationExceptions.java

License:Apache License

/**
 * Reads a {@link TApplicationException} from the specified {@link TProtocol}.
 *
 * <p>Note: This has been copied from {@link TApplicationException#read(TProtocol)} due to API differences
 * between libthrift 0.9.x and 0.10.x./*ww w . j a  v  a 2 s. c  o  m*/
 */
public static TApplicationException read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();

    String message = null;
    int type = TApplicationException.UNKNOWN;

    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1:
            if (field.type == TType.STRING) {
                message = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2:
            if (field.type == TType.I32) {
                type = iprot.readI32();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
            break;
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    return new TApplicationException(type, message);
}