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