| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # | 
| 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 | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | #   http://www.apache.org/licenses/LICENSE-2.0 | 
| 11 |  |  |  |  |  |  | # | 
| 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 | 
| 17 |  |  |  |  |  |  | # under the License. | 
| 18 |  |  |  |  |  |  | # | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 3 |  |  | 3 |  | 37 | use 5.10.0; | 
|  | 3 |  |  |  |  | 11 |  | 
| 21 | 3 |  |  | 3 |  | 16 | use strict; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 60 |  | 
| 22 | 3 |  |  | 3 |  | 16 | use warnings; | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 88 |  | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 3 |  |  | 3 |  | 17 | use Thrift; | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 99 |  | 
| 25 | 3 |  |  | 3 |  | 1129 | use Thrift::Type; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 115 |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | package Thrift::TException; | 
| 28 | 3 |  |  | 3 |  | 17 | use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); | 
|  | 3 |  |  |  |  | 43 |  | 
|  | 3 |  |  |  |  | 15 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | use overload '""' => sub { | 
| 31 |  |  |  |  |  |  | return | 
| 32 |  |  |  |  |  |  | sprintf '%s error: %s (code %s)', | 
| 33 |  |  |  |  |  |  | ref( $_[0] ), | 
| 34 |  |  |  |  |  |  | ( $_[0]->{message} || 'empty message' ), | 
| 35 | 0 | 0 | 0 | 0 |  | 0 | ( defined $_[0]->{code} ? $_[0]->{code} : 'undefined' ); | 
| 36 | 3 |  |  | 3 |  | 4339 | }; | 
|  | 3 |  |  |  |  | 2996 |  | 
|  | 3 |  |  |  |  | 28 |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub new { | 
| 39 | 1 |  |  | 1 |  | 3 | my $classname = shift; | 
| 40 | 1 |  | 50 |  |  | 6 | my $self = {message => shift, code => shift || 0}; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 1 |  |  |  |  | 3 | return bless($self,$classname); | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | package Thrift::TApplicationException; | 
| 46 | 3 |  |  | 3 |  | 1911 | use parent -norequire, 'Thrift::TException'; | 
|  | 3 |  |  |  |  | 910 |  | 
|  | 3 |  |  |  |  | 19 |  | 
| 47 | 3 |  |  | 3 |  | 177 | use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); | 
|  | 3 |  |  |  |  | 126 |  | 
|  | 3 |  |  |  |  | 23 |  | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 3 |  |  | 3 |  | 298 | use constant UNKNOWN                 => 0; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 202 |  | 
| 50 | 3 |  |  | 3 |  | 17 | use constant UNKNOWN_METHOD          => 1; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 183 |  | 
| 51 | 3 |  |  | 3 |  | 18 | use constant INVALID_MESSAGE_TYPE    => 2; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 148 |  | 
| 52 | 3 |  |  | 3 |  | 17 | use constant WRONG_METHOD_NAME       => 3; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 145 |  | 
| 53 | 3 |  |  | 3 |  | 18 | use constant BAD_SEQUENCE_ID         => 4; | 
|  | 3 |  |  |  |  | 13 |  | 
|  | 3 |  |  |  |  | 156 |  | 
| 54 | 3 |  |  | 3 |  | 19 | use constant MISSING_RESULT          => 5; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 151 |  | 
| 55 | 3 |  |  | 3 |  | 19 | use constant INTERNAL_ERROR          => 6; | 
|  | 3 |  |  |  |  | 5 |  | 
|  | 3 |  |  |  |  | 153 |  | 
| 56 | 3 |  |  | 3 |  | 19 | use constant PROTOCOL_ERROR          => 7; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 152 |  | 
| 57 | 3 |  |  | 3 |  | 27 | use constant INVALID_TRANSFORM       => 8; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 143 |  | 
| 58 | 3 |  |  | 3 |  | 17 | use constant INVALID_PROTOCOL        => 9; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 141 |  | 
| 59 | 3 |  |  | 3 |  | 17 | use constant UNSUPPORTED_CLIENT_TYPE => 10; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 1789 |  | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | sub new { | 
| 62 | 0 |  |  | 0 |  |  | my $classname = shift; | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 |  |  |  |  |  | my $self = $classname->SUPER::new(@_); | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 0 |  |  |  |  |  | return bless($self,$classname); | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | sub read { | 
| 70 | 0 |  |  | 0 |  |  | my $self  = shift; | 
| 71 | 0 |  |  |  |  |  | my $input = shift; | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  |  |  |  |  | my $xfer  = 0; | 
| 74 | 0 |  |  |  |  |  | my $fname = undef; | 
| 75 | 0 |  |  |  |  |  | my $ftype = 0; | 
| 76 | 0 |  |  |  |  |  | my $fid   = 0; | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 0 |  |  |  |  |  | $xfer += $input->readStructBegin(\$fname); | 
| 79 |  |  |  |  |  |  |  | 
| 80 | 0 |  |  |  |  |  | while (1) | 
| 81 |  |  |  |  |  |  | { | 
| 82 | 0 |  |  |  |  |  | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | 
| 83 | 0 | 0 |  |  |  |  | if ($ftype == Thrift::TType::STOP) { | 
| 84 | 0 |  |  |  |  |  | last; next; | 
|  | 0 |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | } | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 0 |  |  |  |  |  | SWITCH: for($fid) | 
| 88 |  |  |  |  |  |  | { | 
| 89 | 0 | 0 |  |  |  |  | /1/ && do{ | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 0 | 0 |  |  |  |  | if ($ftype == Thrift::TType::STRING) { | 
| 92 | 0 |  |  |  |  |  | $xfer += $input->readString(\$self->{message}); | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  | else { | 
| 95 | 0 |  |  |  |  |  | $xfer += $input->skip($ftype); | 
| 96 |  |  |  |  |  |  | } | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 0 |  |  |  |  |  | last; | 
| 99 |  |  |  |  |  |  | }; | 
| 100 |  |  |  |  |  |  |  | 
| 101 | 0 | 0 |  |  |  |  | /2/ && do{ | 
| 102 | 0 | 0 |  |  |  |  | if ($ftype == Thrift::TType::I32) { | 
| 103 | 0 |  |  |  |  |  | $xfer += $input->readI32(\$self->{code}); | 
| 104 |  |  |  |  |  |  | } | 
| 105 |  |  |  |  |  |  | else { | 
| 106 | 0 |  |  |  |  |  | $xfer += $input->skip($ftype); | 
| 107 |  |  |  |  |  |  | } | 
| 108 | 0 |  |  |  |  |  | last; | 
| 109 |  |  |  |  |  |  | }; | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 0 |  |  |  |  |  | $xfer += $input->skip($ftype); | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 | 0 |  |  |  |  |  | $xfer += $input->readFieldEnd(); | 
| 115 |  |  |  |  |  |  | } | 
| 116 | 0 |  |  |  |  |  | $xfer += $input->readStructEnd(); | 
| 117 |  |  |  |  |  |  |  | 
| 118 | 0 |  |  |  |  |  | return $xfer; | 
| 119 |  |  |  |  |  |  | } | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | sub write { | 
| 122 | 0 |  |  | 0 |  |  | my $self   = shift; | 
| 123 | 0 |  |  |  |  |  | my $output = shift; | 
| 124 |  |  |  |  |  |  |  | 
| 125 | 0 |  |  |  |  |  | my $xfer   = 0; | 
| 126 |  |  |  |  |  |  |  | 
| 127 | 0 |  |  |  |  |  | $xfer += $output->writeStructBegin('TApplicationException'); | 
| 128 |  |  |  |  |  |  |  | 
| 129 | 0 | 0 |  |  |  |  | if ($self->getMessage()) { | 
| 130 | 0 |  |  |  |  |  | $xfer += $output->writeFieldBegin('message', Thrift::TType::STRING, 1); | 
| 131 | 0 |  |  |  |  |  | $xfer += $output->writeString($self->getMessage()); | 
| 132 | 0 |  |  |  |  |  | $xfer += $output->writeFieldEnd(); | 
| 133 |  |  |  |  |  |  | } | 
| 134 |  |  |  |  |  |  |  | 
| 135 | 0 | 0 |  |  |  |  | if ($self->getCode()) { | 
| 136 | 0 |  |  |  |  |  | $xfer += $output->writeFieldBegin('type', Thrift::TType::I32, 2); | 
| 137 | 0 |  |  |  |  |  | $xfer += $output->writeI32($self->getCode()); | 
| 138 | 0 |  |  |  |  |  | $xfer += $output->writeFieldEnd(); | 
| 139 |  |  |  |  |  |  | } | 
| 140 |  |  |  |  |  |  |  | 
| 141 | 0 |  |  |  |  |  | $xfer += $output->writeFieldStop(); | 
| 142 | 0 |  |  |  |  |  | $xfer += $output->writeStructEnd(); | 
| 143 |  |  |  |  |  |  |  | 
| 144 | 0 |  |  |  |  |  | return $xfer; | 
| 145 |  |  |  |  |  |  | } | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | sub getMessage | 
| 148 |  |  |  |  |  |  | { | 
| 149 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 150 |  |  |  |  |  |  |  | 
| 151 | 0 |  |  |  |  |  | return $self->{message}; | 
| 152 |  |  |  |  |  |  | } | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | sub getCode | 
| 155 |  |  |  |  |  |  | { | 
| 156 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 157 |  |  |  |  |  |  |  | 
| 158 | 0 |  |  |  |  |  | return $self->{code}; | 
| 159 |  |  |  |  |  |  | } | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | 1; |