]> 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:50:34 +0000 (04:50 +0000)
committerlpsolit%gmail.com <>
Mon, 24 Oct 2005 04:50:34 +0000 (04:50 +0000)
attachment.cgi
enter_bug.cgi
post_bug.cgi
report.cgi
template/en/default/global/code-error.html.tmpl
template/en/default/global/user-error.html.tmpl
token.cgi

index f87f378d544f5be7be5e95a6edf37b7482596746..d452322d0690d17186cd314c390ea1405cbd0b3f 100755 (executable)
@@ -586,7 +586,7 @@ sub get_unified_diff
   my ($bugid, $description, $ispatch, $thedata) = FetchSQLData();
   if (!$ispatch) {
     $vars->{'attach_id'} = $id;
-    ThrowCodeError("must_be_patch");
+    ThrowUserError("must_be_patch");
   }
 
   # Reads in the patch, converting to unified diff in a temp file
index ecded81dfcd26cdb46516ad96a63b4799b95670e..3e6b741afbe96375e087b34968facb143fa3023e 100755 (executable)
@@ -339,10 +339,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 9d92c3c98955beb74b4365a3769db8c7b51d66fe..656ae187f101c4d14d728482213b01a15b544b84 100755 (executable)
@@ -330,7 +330,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 30c7cade8731519d20d03da5442e40ea650c4df7..d908c77f9d3a31ce0ca0b9372c92edc6087d7281 100755 (executable)
@@ -289,7 +289,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 = GetFormat("reports/report", $formatparam, $cgi->param('ctype'));
index 608e9a08fea16f352f61a5f726c7301430c7bd24..d4aa41d712b4ad774341744f2b9c554da08f5b05 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_series_id" %]
     [% title = "Invalid Series" %]
     The series_id [% series_id FILTER html %] is not valid. It may be that
     [%+ 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.
 
index f16544b5db130d85cc43360a34f53011a2f50b2f..57df2404591d2f659e1507bcae832b889602bc6f 100644 (file)
     [% 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. 
     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).
         
     The context [% context FILTER html %] is invalid (must be a number,
     "file" or "patch").
 
-  [% ELSIF error == "invalid_field_name" %]
-    [% title = "Invalid Field Name" %]
-    The field "[% name FILTER html %]" is invalid.
-
   [% ELSIF error == "invalid_format" %]
     [% title = "Invalid Format" %]
     The format "[% format FILTER html %]" is invalid (must be one of
     the new assignee. If you did not intentionally clear out the 
     "Reassign [% terms.bug %] to" field, [% Param("browserbugmessage") %]
 
-  [% 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 0e0753807197c27b5c247749eac8d0b26c042a78..3fe8e014098c30f0dbd612d3fb2455ff1775384a 100755 (executable)
--- a/token.cgi
+++ b/token.cgi
@@ -68,11 +68,8 @@ if ($cgi->param('t')) {
   $::quotedtoken = SqlQuote($::token);
   
   # 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);
 
   Bugzilla::Token::CleanTokenTable();