Commit 0b7d9e7f authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 284975: Any code after Throw*Error is a dead code.

Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=LpSolit, a=myk
parent 5b1b54e9
...@@ -72,7 +72,6 @@ if (defined($login)) { ...@@ -72,7 +72,6 @@ if (defined($login)) {
if (!($createexp) if (!($createexp)
|| ($login !~ /$createexp/)) { || ($login !~ /$createexp/)) {
ThrowUserError("account_creation_disabled"); ThrowUserError("account_creation_disabled");
exit;
} }
# Create account # Create account
......
...@@ -300,7 +300,7 @@ if ($action eq 'update') { ...@@ -300,7 +300,7 @@ if ($action eq 'update') {
if ($classification ne $classificationold) { if ($classification ne $classificationold) {
unless ($classification) { unless ($classification) {
ThrowUserError("classification_not_specified") ThrowUserError("classification_not_specified");
} }
if (TestClassification($classification)) { if (TestClassification($classification)) {
......
...@@ -67,13 +67,11 @@ sub CheckProduct ($) ...@@ -67,13 +67,11 @@ sub CheckProduct ($)
# do we have a product? # do we have a product?
unless ($prod) { unless ($prod) {
ThrowUserError('product_not_specified'); ThrowUserError('product_not_specified');
exit;
} }
unless (TestProduct $prod) { unless (TestProduct $prod) {
ThrowUserError('product_doesnt_exist', ThrowUserError('product_doesnt_exist',
{'product' => $prod}); {'product' => $prod});
exit;
} }
} }
...@@ -97,7 +95,6 @@ sub CheckComponent ($$) ...@@ -97,7 +95,6 @@ sub CheckComponent ($$)
# do we have the component? # do we have the component?
unless ($comp) { unless ($comp) {
ThrowUserError('component_not_specified'); ThrowUserError('component_not_specified');
exit;
} }
CheckProduct($prod); CheckProduct($prod);
...@@ -106,7 +103,6 @@ sub CheckComponent ($$) ...@@ -106,7 +103,6 @@ sub CheckComponent ($$)
ThrowUserError('component_not_valid', ThrowUserError('component_not_valid',
{'product' => $prod, {'product' => $prod,
'name' => $comp}); 'name' => $comp});
exit;
} }
} }
...@@ -267,18 +263,15 @@ if ($action eq 'new') { ...@@ -267,18 +263,15 @@ if ($action eq 'new') {
unless ($component) { unless ($component) {
ThrowUserError('component_blank_name', ThrowUserError('component_blank_name',
{'name' => $component}); {'name' => $component});
exit;
} }
if (TestComponent($product, $component)) { if (TestComponent($product, $component)) {
ThrowUserError('component_already_exists', ThrowUserError('component_already_exists',
{'name' => $component}); {'name' => $component});
exit;
} }
if (length($component) > 64) { if (length($component) > 64) {
ThrowUserError('component_name_too_long', ThrowUserError('component_name_too_long',
{'name' => $component}); {'name' => $component});
exit;
} }
my $description = trim($cgi->param('description') || ''); my $description = trim($cgi->param('description') || '');
...@@ -286,7 +279,6 @@ if ($action eq 'new') { ...@@ -286,7 +279,6 @@ if ($action eq 'new') {
if ($description eq '') { if ($description eq '') {
ThrowUserError('component_blank_description', ThrowUserError('component_blank_description',
{'name' => $component}); {'name' => $component});
exit;
} }
my $initialowner = trim($cgi->param('initialowner') || ''); my $initialowner = trim($cgi->param('initialowner') || '');
...@@ -294,14 +286,12 @@ if ($action eq 'new') { ...@@ -294,14 +286,12 @@ if ($action eq 'new') {
if ($initialowner eq '') { if ($initialowner eq '') {
ThrowUserError('component_need_initialowner', ThrowUserError('component_need_initialowner',
{'name' => $component}); {'name' => $component});
exit;
} }
my $initialownerid = login_to_id ($initialowner); my $initialownerid = login_to_id ($initialowner);
if (!$initialownerid) { if (!$initialownerid) {
ThrowUserError('component_need_valid_initialowner', ThrowUserError('component_need_valid_initialowner',
{'name' => $component}); {'name' => $component});
exit;
} }
my $initialqacontact = trim($cgi->param('initialqacontact') || ''); my $initialqacontact = trim($cgi->param('initialqacontact') || '');
...@@ -310,7 +300,6 @@ if ($action eq 'new') { ...@@ -310,7 +300,6 @@ if ($action eq 'new') {
if (!$initialqacontactid && $initialqacontact ne '') { if (!$initialqacontactid && $initialqacontact ne '') {
ThrowUserError('component_need_valid_initialqacontact', ThrowUserError('component_need_valid_initialqacontact',
{'name' => $component}); {'name' => $component});
exit;
} }
} }
...@@ -571,7 +560,6 @@ if ($action eq 'update') { ...@@ -571,7 +560,6 @@ if ($action eq 'update') {
if (length($component) > 64) { if (length($component) > 64) {
ThrowUserError('component_name_too_long', ThrowUserError('component_name_too_long',
{'name' => $component}); {'name' => $component});
exit;
} }
# Note that the order of this tests is important. If you change # Note that the order of this tests is important. If you change
...@@ -587,7 +575,6 @@ if ($action eq 'update') { ...@@ -587,7 +575,6 @@ if ($action eq 'update') {
unless ($description) { unless ($description) {
ThrowUserError('component_blank_description', ThrowUserError('component_blank_description',
{'name' => $componentold}); {'name' => $componentold});
exit;
} }
SendSQL("UPDATE components SendSQL("UPDATE components
SET description=" . SqlQuote($description) . " SET description=" . SqlQuote($description) . "
...@@ -604,7 +591,6 @@ if ($action eq 'update') { ...@@ -604,7 +591,6 @@ if ($action eq 'update') {
unless ($initialownerid) { unless ($initialownerid) {
ThrowUserError('component_need_valid_initialowner', ThrowUserError('component_need_valid_initialowner',
{'name' => $componentold}); {'name' => $componentold});
exit;
} }
SendSQL("UPDATE components SendSQL("UPDATE components
...@@ -621,7 +607,6 @@ if ($action eq 'update') { ...@@ -621,7 +607,6 @@ if ($action eq 'update') {
if (!$initialqacontactid && $initialqacontact ne '') { if (!$initialqacontactid && $initialqacontact ne '') {
ThrowUserError('component_need_valid_initialqacontact', ThrowUserError('component_need_valid_initialqacontact',
{'name' => $componentold}); {'name' => $componentold});
exit;
} }
SendSQL("UPDATE components SendSQL("UPDATE components
...@@ -637,12 +622,10 @@ if ($action eq 'update') { ...@@ -637,12 +622,10 @@ if ($action eq 'update') {
unless ($component) { unless ($component) {
ThrowUserError('component_must_have_a_name', ThrowUserError('component_must_have_a_name',
{'name' => $componentold}); {'name' => $componentold});
exit;
} }
if (TestComponent($product, $component)) { if (TestComponent($product, $component)) {
ThrowUserError('component_already_exists', ThrowUserError('component_already_exists',
{'name' => $component}); {'name' => $component});
exit;
} }
SendSQL("UPDATE components SET name=" . SqlQuote($component) . SendSQL("UPDATE components SET name=" . SqlQuote($component) .
......
...@@ -37,15 +37,12 @@ sub Validate ($$) { ...@@ -37,15 +37,12 @@ sub Validate ($$) {
my ($name, $description) = @_; my ($name, $description) = @_;
if ($name eq "") { if ($name eq "") {
ThrowUserError("keyword_blank_name"); ThrowUserError("keyword_blank_name");
exit;
} }
if ($name =~ /[\s,]/) { if ($name =~ /[\s,]/) {
ThrowUserError("keyword_invalid_name"); ThrowUserError("keyword_invalid_name");
exit;
} }
if ($description eq "") { if ($description eq "") {
ThrowUserError("keyword_blank_description"); ThrowUserError("keyword_blank_description");
exit;
} }
} }
...@@ -124,7 +121,6 @@ if ($action eq 'new') { ...@@ -124,7 +121,6 @@ if ($action eq 'new') {
if (FetchOneColumn()) { if (FetchOneColumn()) {
$vars->{'name'} = $name; $vars->{'name'} = $name;
ThrowUserError("keyword_already_exists"); ThrowUserError("keyword_already_exists");
exit;
} }
...@@ -183,7 +179,6 @@ if ($action eq 'edit') { ...@@ -183,7 +179,6 @@ if ($action eq 'edit') {
if (!$name) { if (!$name) {
$vars->{'id'} = $id; $vars->{'id'} = $id;
ThrowCodeError("invalid_keyword_id", $vars); ThrowCodeError("invalid_keyword_id", $vars);
exit;
} }
SendSQL("SELECT count(*) SendSQL("SELECT count(*)
...@@ -227,7 +222,6 @@ if ($action eq 'update') { ...@@ -227,7 +222,6 @@ if ($action eq 'update') {
if ($tmp && $tmp != $id) { if ($tmp && $tmp != $id) {
$vars->{'name'} = $name; $vars->{'name'} = $name;
ThrowUserError("keyword_already_exists", $vars); ThrowUserError("keyword_already_exists", $vars);
exit;
} }
SendSQL("UPDATE keyworddefs SET name = " . SqlQuote($name) . SendSQL("UPDATE keyworddefs SET name = " . SqlQuote($name) .
......
...@@ -60,14 +60,12 @@ sub CheckProduct ($) ...@@ -60,14 +60,12 @@ sub CheckProduct ($)
# do we have a product? # do we have a product?
unless ($product) { unless ($product) {
ThrowUserError('product_not_specified'); ThrowUserError('product_not_specified');
exit;
} }
# Does it exist in the DB? # Does it exist in the DB?
unless (TestProduct $product) { unless (TestProduct $product) {
ThrowUserError('product_doesnt_exist', ThrowUserError('product_doesnt_exist',
{'product' => $product}); {'product' => $product});
exit;
} }
} }
...@@ -104,7 +102,6 @@ sub CheckMilestone ($$) ...@@ -104,7 +102,6 @@ sub CheckMilestone ($$)
# do we have the milestone and product combination? # do we have the milestone and product combination?
unless ($milestone) { unless ($milestone) {
ThrowUserError('milestone_not_specified'); ThrowUserError('milestone_not_specified');
exit;
} }
CheckProduct($product); CheckProduct($product);
...@@ -113,7 +110,6 @@ sub CheckMilestone ($$) ...@@ -113,7 +110,6 @@ sub CheckMilestone ($$)
ThrowUserError('milestone_not_valid', ThrowUserError('milestone_not_valid',
{'product' => $product, {'product' => $product,
'milestone' => $milestone}); 'milestone' => $milestone});
exit;
} }
} }
...@@ -254,13 +250,11 @@ if ($action eq 'new') { ...@@ -254,13 +250,11 @@ if ($action eq 'new') {
unless ($milestone) { unless ($milestone) {
ThrowUserError('milestone_blank_name', ThrowUserError('milestone_blank_name',
{'name' => $milestone}); {'name' => $milestone});
exit;
} }
if (length($milestone) > 20) { if (length($milestone) > 20) {
ThrowUserError('milestone_name_too_long', ThrowUserError('milestone_name_too_long',
{'name' => $milestone}); {'name' => $milestone});
exit;
} }
# Need to store in case detaint_natural() clears the sortkey # Need to store in case detaint_natural() clears the sortkey
...@@ -269,13 +263,11 @@ if ($action eq 'new') { ...@@ -269,13 +263,11 @@ if ($action eq 'new') {
ThrowUserError('milestone_sortkey_invalid', ThrowUserError('milestone_sortkey_invalid',
{'name' => $milestone, {'name' => $milestone,
'sortkey' => $stored_sortkey}); 'sortkey' => $stored_sortkey});
exit;
} }
if (TestMilestone($product, $milestone)) { if (TestMilestone($product, $milestone)) {
ThrowUserError('milestone_already_exists', ThrowUserError('milestone_already_exists',
{'name' => $milestone, {'name' => $milestone,
'product' => $product}); 'product' => $product});
exit;
} }
# Add the new milestone # Add the new milestone
...@@ -492,7 +484,6 @@ if ($action eq 'update') { ...@@ -492,7 +484,6 @@ if ($action eq 'update') {
if (length($milestone) > 20) { if (length($milestone) > 20) {
ThrowUserError('milestone_name_too_long', ThrowUserError('milestone_name_too_long',
{'name' => $milestone}); {'name' => $milestone});
exit;
} }
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
...@@ -509,7 +500,6 @@ if ($action eq 'update') { ...@@ -509,7 +500,6 @@ if ($action eq 'update') {
ThrowUserError('milestone_sortkey_invalid', ThrowUserError('milestone_sortkey_invalid',
{'name' => $milestone, {'name' => $milestone,
'sortkey' => $stored_sortkey}); 'sortkey' => $stored_sortkey});
exit;
} }
trick_taint($milestoneold); trick_taint($milestoneold);
...@@ -530,13 +520,11 @@ if ($action eq 'update') { ...@@ -530,13 +520,11 @@ if ($action eq 'update') {
if ($milestone ne $milestoneold) { if ($milestone ne $milestoneold) {
unless ($milestone) { unless ($milestone) {
ThrowUserError('milestone_blank_name'); ThrowUserError('milestone_blank_name');
exit;
} }
if (TestMilestone($product, $milestone)) { if (TestMilestone($product, $milestone)) {
ThrowUserError('milestone_already_exists', ThrowUserError('milestone_already_exists',
{'name' => $milestone, {'name' => $milestone,
'product' => $product}); 'product' => $product});
exit;
} }
trick_taint($milestone); trick_taint($milestone);
......
...@@ -129,13 +129,11 @@ sub CheckClassificationNew ($) ...@@ -129,13 +129,11 @@ sub CheckClassificationNew ($)
# do we have a classification? # do we have a classification?
unless ($cl) { unless ($cl) {
ThrowUserError('classification_not_specified'); ThrowUserError('classification_not_specified');
exit;
} }
unless (TestClassification $cl) { unless (TestClassification $cl) {
ThrowUserError('classification_doesnt_exist', ThrowUserError('classification_doesnt_exist',
{'name' => $cl}); {'name' => $cl});
exit;
} }
} }
......
...@@ -64,13 +64,11 @@ sub CheckProduct ($) ...@@ -64,13 +64,11 @@ sub CheckProduct ($)
# do we have a product? # do we have a product?
unless ($prod) { unless ($prod) {
ThrowUserError('product_not_specified'); ThrowUserError('product_not_specified');
exit;
} }
unless (TestProduct $prod) { unless (TestProduct $prod) {
ThrowUserError('product_doesnt_exist', ThrowUserError('product_doesnt_exist',
{'product' => $prod}); {'product' => $prod});
exit;
} }
} }
...@@ -94,7 +92,6 @@ sub CheckVersion ($$) ...@@ -94,7 +92,6 @@ sub CheckVersion ($$)
# do we have the version? # do we have the version?
unless ($ver) { unless ($ver) {
ThrowUserError('version_not_specified'); ThrowUserError('version_not_specified');
exit;
} }
CheckProduct($prod); CheckProduct($prod);
...@@ -103,7 +100,6 @@ sub CheckVersion ($$) ...@@ -103,7 +100,6 @@ sub CheckVersion ($$)
ThrowUserError('version_not_valid', ThrowUserError('version_not_valid',
{'product' => $prod, {'product' => $prod,
'version' => $ver}); 'version' => $ver});
exit;
} }
} }
...@@ -233,14 +229,12 @@ if ($action eq 'new') { ...@@ -233,14 +229,12 @@ if ($action eq 'new') {
unless ($version) { unless ($version) {
ThrowUserError('version_blank_name', ThrowUserError('version_blank_name',
{'name' => $version}); {'name' => $version});
exit;
} }
if (TestVersion($product,$version)) { if (TestVersion($product,$version)) {
ThrowUserError('version_already_exists', ThrowUserError('version_already_exists',
{'name' => $version, {'name' => $version,
'product' => $product}); 'product' => $product});
exit;
} }
# Add the new version # Add the new version
...@@ -407,13 +401,11 @@ if ($action eq 'update') { ...@@ -407,13 +401,11 @@ if ($action eq 'update') {
if ($version ne $versionold) { if ($version ne $versionold) {
unless ($version) { unless ($version) {
ThrowUserError('version_blank_name'); ThrowUserError('version_blank_name');
exit;
} }
if (TestVersion($product,$version)) { if (TestVersion($product,$version)) {
ThrowUserError('version_already_exists', ThrowUserError('version_already_exists',
{'name' => $version, {'name' => $version,
'product' => $product}); 'product' => $product});
exit;
} }
SendSQL("UPDATE bugs SendSQL("UPDATE bugs
SET version=" . SqlQuote($version) . " SET version=" . SqlQuote($version) . "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment