summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-10-24 06:47:50 +0200
committerlpsolit%gmail.com <>2005-10-24 06:47:50 +0200
commit46c89016520cf272223cba52e704388fa94b4392 (patch)
tree7fabf7e470cb3609bd6bbdd40a1c23463a10e5e0
parentd0042bb7c9340ef4dd80b3abe3b2f45ed4bf862b (diff)
downloadbugzilla-46c89016520cf272223cba52e704388fa94b4392.tar.gz
bugzilla-46c89016520cf272223cba52e704388fa94b4392.tar.xz
Bug 312307: Misused Throw*Error tags in code and templates - Patch by Dennis Melentyev <dennis.melentyev@infopulse.com.ua> r=LpSolit a=justdave
-rwxr-xr-xenter_bug.cgi5
-rwxr-xr-xpost_bug.cgi2
-rwxr-xr-xrelogin.cgi2
-rwxr-xr-xreport.cgi2
-rw-r--r--template/en/default/global/code-error.html.tmpl16
-rw-r--r--template/en/default/global/user-error.html.tmpl40
-rwxr-xr-xtoken.cgi6
7 files changed, 17 insertions, 56 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi
index e2772ccec..569d9554c 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -334,10 +334,7 @@ GetVersionTable();
my $product_id = get_product_id($product);
-if (0 == @{$::components{$product}}) {
- ThrowUserError("no_components", {product => $product});
-}
-elsif (1 == @{$::components{$product}}) {
+if (1 == @{$::components{$product}}) {
# Only one component; just pick it.
$cgi->param('component', $::components{$product}->[0]);
}
diff --git a/post_bug.cgi b/post_bug.cgi
index 18faa5090..0965728b7 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -328,7 +328,7 @@ foreach my $b (grep(/^bit-\d*$/, $cgi->param())) {
if ($cgi->param($b)) {
my $v = substr($b, 4);
detaint_natural($v)
- || ThrowCodeError("group_id_invalid");
+ || ThrowUserError("invalid_group_ID");
if (!GroupIsActive($v)) {
# Prevent the user from adding the bug to an inactive group.
# Should only happen if there is a bug in Bugzilla or the user
diff --git a/relogin.cgi b/relogin.cgi
index 58ac84769..a8ebd18f4 100755
--- a/relogin.cgi
+++ b/relogin.cgi
@@ -56,7 +56,7 @@ if ($action eq 'sudo') {
# Do not try to start a new session if one is already in progress!
if (defined(Bugzilla->sudoer)) {
- ThrowUserError('sudo-in-progress', { target => $user->login });
+ ThrowUserError('sudo_in_progress', { target => $user->login });
}
# We may have been given a value to put into the field
diff --git a/report.cgi b/report.cgi
index f9a56588f..79c72beaa 100755
--- a/report.cgi
+++ b/report.cgi
@@ -290,7 +290,7 @@ elsif ($action eq "plot") {
$vars->{'data'} = \@image_data;
}
else {
- ThrowUserError("unknown_action", {action => $cgi->param('action')});
+ ThrowCodeError("unknown_action", {action => $cgi->param('action')});
}
my $format = $template->get_format("reports/report", $formatparam,
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index 796e1e4b2..534938ff7 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -154,11 +154,6 @@
[%+ terms.bug %] [%+ bug_id FILTER html %].
[% END %]
- [% ELSIF error == "invalid_isactive_flag" %]
- [% title = "Invalid isactive flag" %]
- The active flag was improperly set. There may be
- a problem with [% terms.Bugzilla %] or [% terms.abug %] in your browser.
-
[% ELSIF error == "invalid_numeric_argument" %]
[% title = "Invalid number argument" %]
The argument <code>[% argument FILTER html %] = [% value FILTER html %]</code>
@@ -245,13 +240,12 @@
[%+ series.subcategory FILTER html %] /
[%+ series.name FILTER html %].
- [% ELSIF error == "no_y_axis_defined" %]
- No Y axis was defined when creating report. The X axis is optional,
- but the Y axis is compulsory.
-
[% ELSIF error == "need_quipid" %]
A valid quipid is needed.
+ [% ELSIF error == "unknown_comparison_type" %]
+ Specified comparison type is not supported.
+
[% ELSIF error == "request_queue_group_invalid" %]
The group field <em>[% group FILTER html %]</em> is invalid.
@@ -298,6 +292,10 @@
I could not figure out what you wanted to do.
[% END %]
+ [% ELSIF error == "must_be_patch" %]
+ [% title = "Attachment Must Be Patch" %]
+ Attachment #[% attach_id FILTER html %] must be a patch.
+
[% ELSIF error == "nested_transaction" %]
Attempted to start a new transaction without finishing previous one first.
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index f0c828888..b1c8e7c91 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -276,15 +276,6 @@
You must reassign those [% terms.bugs %] to another component before you
can delete this one.
- [% ELSIF error == "component_must_have_a_name" %]
- [% title = "Blank Component Name Not Allowed" %]
- You cannot delete the component name for component '[% name FILTER html %]'.
-
- [% ELSIF error == "component_cant_del_description" %]
- [% title = "Blank Component Description Not Allowed" %]
- You cannot delete the component description for
- component '[% name FILTER html %]'.
-
[% ELSIF error == "component_name_too_long" %]
[% title = "Component Name Is Too Long" %]
The name of a component is limited to 64 characters.
@@ -294,10 +285,6 @@
[% title = "Component Requires Default Assignee" %]
You must enter a default assignee for component '[% name FILTER html %]'.
- [% ELSIF error == "component_not_specified" %]
- [% title = "No Component Specified" %]
- No component specified when trying to edit components.
-
[% ELSIF error == "component_not_valid" %]
[% title = "Specified Component Does Not Exist" %]
The component '[% name FILTER html %]' for product
@@ -601,11 +588,6 @@
You are not authorised to edit this series. To do this, you must either
be its creator, or an administrator.
- [% ELSIF error == "insufficient_data" %]
- [% title = "Insufficient Data" %]
- None of the series you selected have any data associated with them, so a
- chart cannot be plotted.
-
[% ELSIF error == "insufficient_data_points" %]
We don't have enough data points to make a graph (yet).
@@ -842,10 +824,6 @@
Sorry, [% terms.bug %] moving has been disabled. If you need
to move [% terms.abug %], please contact [% Param("maintainer") %].
- [% ELSIF error == "must_be_patch" %]
- [% title = "Attachment Must Be Patch" %]
- Attachment #[% attach_id FILTER html %] must be a patch.
-
[% ELSIF error == "missing_subcategory" %]
[% title = "Missing Subcategory" %]
You did not specify a subcategory for this series.
@@ -1077,10 +1055,6 @@
To reassign [% terms.abug %], you must provide an address for
the new assignee.
- [% ELSIF error == "report_access_denied" %]
- [% title = "Access Denied" %]
- You do not have the permissions necessary to view reports for this product.
-
[% ELSIF error == "require_component" %]
[% title = "Component Needed" %]
To file this [% terms.bug %], you must first choose a component.
@@ -1199,11 +1173,6 @@
version! You must reassign those [% terms.bugs %] to another version
before you can delete this one.
- [% ELSIF error == "version_name_too_long" %]
- [% title = "Version Name Is Too Long" %]
- The name of a version is limited to 20 characters.
- '[% name FILTER html %]' is too long ([% name.length %] characters).
-
[% ELSIF error == "version_not_specified" %]
[% title = "No Version Specified" %]
No version specified when trying to edit versions.
@@ -1239,15 +1208,14 @@
[% title = "Wrong Token" %]
That token cannot be used to change your password.
+ [% ELSIF error == "extern_id_conflict" %]
+ [% title = "Extern ID Conflict" %]
+ Someone with a different external ID has that address.
+
[% ELSIF error == "wrong_token_for_confirming_email_change" %]
[% title = "Wrong Token" %]
That token cannot be used to change your email address.
- [% ELSIF error == "value_out_of_range" %]
- [% title = "Value Out Of Range" %]
- Value is out of range for field
- <em>[% field_descs.$field FILTER html %]</em>.
-
[% ELSIF error == "zero_length_file" %]
[% title = "File Is Empty" %]
The file you are trying to attach is empty!
diff --git a/token.cgi b/token.cgi
index 6b2eb2b64..3c818bc23 100755
--- a/token.cgi
+++ b/token.cgi
@@ -67,10 +67,8 @@ if ($cgi->param('t')) {
$::token = $cgi->param('t');
# Make sure the token contains only valid characters in the right amount.
- my $validationerror = ValidatePassword($::token);
- if ($validationerror) {
- ThrowUserError("token_invalid");
- }
+ # Validate password will throw an error if token is invalid
+ ValidatePassword($::token);
trick_taint($::token); # Only used in placeholders
Bugzilla::Token::CleanTokenTable();