]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/javame/src/org/apache/thrift/TApplicationException.java
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 package org
.apache
.thrift
;
22 import org
.apache
.thrift
.protocol
.TField
;
23 import org
.apache
.thrift
.protocol
.TProtocol
;
24 import org
.apache
.thrift
.protocol
.TProtocolUtil
;
25 import org
.apache
.thrift
.protocol
.TStruct
;
26 import org
.apache
.thrift
.protocol
.TType
;
29 * Application level exception
32 public class TApplicationException
extends TException
{
34 private static final long serialVersionUID
= 1L;
36 public static final int UNKNOWN
= 0;
37 public static final int UNKNOWN_METHOD
= 1;
38 public static final int INVALID_MESSAGE_TYPE
= 2;
39 public static final int WRONG_METHOD_NAME
= 3;
40 public static final int BAD_SEQUENCE_ID
= 4;
41 public static final int MISSING_RESULT
= 5;
42 public static final int INTERNAL_ERROR
= 6;
43 public static final int PROTOCOL_ERROR
= 7;
44 public static final int INVALID_TRANSFORM
= 8;
45 public static final int INVALID_PROTOCOL
= 9;
46 public static final int UNSUPPORTED_CLIENT_TYPE
= 10;
48 protected int type_
= UNKNOWN
;
50 public TApplicationException() {
54 public TApplicationException(int type
) {
59 public TApplicationException(int type
, String message
) {
64 public TApplicationException(String message
) {
68 public int getType() {
72 public static TApplicationException
read(TProtocol iprot
) throws TException
{
74 iprot
.readStructBegin();
76 String message
= null;
80 field
= iprot
.readFieldBegin();
81 if (field
.type
== TType
.STOP
) {
86 if (field
.type
== TType
.STRING
) {
87 message
= iprot
.readString();
89 TProtocolUtil
.skip(iprot
, field
.type
);
93 if (field
.type
== TType
.I32
) {
94 type
= iprot
.readI32();
96 TProtocolUtil
.skip(iprot
, field
.type
);
100 TProtocolUtil
.skip(iprot
, field
.type
);
103 iprot
.readFieldEnd();
105 iprot
.readStructEnd();
107 return new TApplicationException(type
, message
);
110 public void write(TProtocol oprot
) throws TException
{
111 TStruct struct
= new TStruct("TApplicationException");
112 TField field
= new TField();
113 oprot
.writeStructBegin(struct
);
114 if (getMessage() != null) {
115 field
.name
= "message";
116 field
.type
= TType
.STRING
;
118 oprot
.writeFieldBegin(field
);
119 oprot
.writeString(getMessage());
120 oprot
.writeFieldEnd();
123 field
.type
= TType
.I32
;
125 oprot
.writeFieldBegin(field
);
126 oprot
.writeI32(type_
);
127 oprot
.writeFieldEnd();
128 oprot
.writeFieldStop();
129 oprot
.writeStructEnd();