| 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 | ▶ | use 5.10.0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 3 | ▶ | use Thrift; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | 3 | ▶ | use Thrift::Type; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | package Thrift::TException; | ||||||||||||||||||||
| 28 | 3 | ▶ | use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 3 | ▶ | use overload '""' => sub { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.2
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 31 | return | ||||||||||||||||||||
| 32 | sprintf '%s error: %s (code %s)', | ||||||||||||||||||||
| 33 | ref( $_[0] ), | ||||||||||||||||||||
| 34 | ( $_[0]->{message} || 'empty message' ), | ||||||||||||||||||||
| 35 | 0 | ▶ | ( defined $_[0]->{code} ? $_[0]->{code} : 'undefined' ); | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_[0]{'message'} || 'empty message'
MC/DC0%0/1
$_[0]{'message'} || 'empty message'
$_[0]{'message'}
Truth table0%0/2
A
A= $_[0]{'message'}
| |||||||||||||||||||||
| 36 | 3 | }; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
| |||||||||||||||||||||
| 39 | 1 | my $classname = shift; | |||||||||||||||||||
| 40 | 1 | ▶ | my $self = {message => shift, code => shift || 0}; | ||||||||||||||||||
|
Condition50%1/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 1 | return bless($self,$classname); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | package Thrift::TApplicationException; | ||||||||||||||||||||
| 46 | 3 | ▶ | use parent -norequire, 'Thrift::TException'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | 3 | ▶ | use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 3 | ▶ | use constant UNKNOWN => 0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 50 | 3 | ▶ | use constant UNKNOWN_METHOD => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 51 | 3 | ▶ | use constant INVALID_MESSAGE_TYPE => 2; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 52 | 3 | ▶ | use constant WRONG_METHOD_NAME => 3; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 53 | 3 | ▶ | use constant BAD_SEQUENCE_ID => 4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | 3 | ▶ | use constant MISSING_RESULT => 5; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 55 | 3 | ▶ | use constant INTERNAL_ERROR => 6; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 56 | 3 | ▶ | use constant PROTOCOL_ERROR => 7; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 57 | 3 | ▶ | use constant INVALID_TRANSFORM => 8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 58 | 3 | ▶ | use constant INVALID_PROTOCOL => 9; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 59 | 3 | ▶ | use constant UNSUPPORTED_CLIENT_TYPE => 10; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 62 | 0 | my $classname = shift; | |||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 0 | my $self = $classname->SUPER::new(@_); | |||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | return bless($self,$classname); | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=7 SCAR=40.3
| |||||||||||||||||||||
| 70 | 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 | ▶ | if ($ftype == Thrift::TType::STOP) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 84 | 0 | last; next; | |||||||||||||||||||
| 85 | } | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 0 | SWITCH: for($fid) | |||||||||||||||||||
| 88 | { | ||||||||||||||||||||
| 89 | 0 | ▶ | /1/ && do{ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 0 | ▶ | if ($ftype == Thrift::TType::STRING) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | ▶ | /2/ && do{ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 102 | 0 | ▶ | if ($ftype == Thrift::TType::I32) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | 0 | ▶ | sub write { | ||||||||||||||||||
|
Subroutine
write: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 122 | 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 | ▶ | if ($self->getMessage()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | ▶ | if ($self->getCode()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
getMessage: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 149 | 0 | my $self = shift; | |||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 0 | return $self->{message}; | |||||||||||||||||||
| 152 | } | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | sub getCode | ||||||||||||||||||||
| 155 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
getCode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 156 | 0 | my $self = shift; | |||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 0 | return $self->{code}; | |||||||||||||||||||
| 159 | } | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | 3 | 1; | |||||||||||||||||||