]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 312307: Misused Throw*Error tags in code and templates - Patch by Dennis Melentye...
authorlpsolit%gmail.com <>
Mon, 24 Oct 2005 04:47:50 +0000 (04:47 +0000)
committerlpsolit%gmail.com <>
Mon, 24 Oct 2005 04:47:50 +0000 (04:47 +0000)
enter_bug.cgi
post_bug.cgi
relogin.cgi
report.cgi
template/en/default/global/code-error.html.tmpl
template/en/default/global/user-error.html.tmpl
token.cgi

index e2772cceca821b65d47375182b8a3eaef9c1a600..569d9554c33159416c9739b2a55c4645d2fd72b7 100755 (executable)
@@ -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]);
 }
index 18faa5090824347cb91ad8b4a134c7c44cd19b07..0965728b70012cc6c288818e69aa1a78814b9f21 100755 (executable)
@@ -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
index 58ac84769a0d850f8f270821851276f163997436..a8ebd18f40003114156bd7ee88c1643295590324 100755 (executable)
@@ -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
index f9a56588f5d930a5ded9a62c676259e4de3347ba..79c72beaaa244d019a2bd202b3345e14c71844ff 100755 (executable)
@@ -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,
index 796e1e4b28ad4ca637555574c23026d1deef9155..534938ff714d51e80ad37f17ad9767eb9f23bd46 100644 (file)
       [%+ 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>
     [%+ 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.
 
        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.
 
index f0c8288880ac998c561385e76dc9c23622b8e041..b1c8e7c91683cfb290ccc20393212201369ba3c8 100644 (file)
     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. 
     [% 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 
     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).
         
     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.
     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.
     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.
     [% 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!
index 6b2eb2b64aaa77aa8005182e243589abd0d825b5..3c818bc23605daa20e5d4e29d312981274700fae 100755 (executable)
--- 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();