From 74f6086412964f1bcbb28dc415d669140e27fbc2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Mon, 7 Jan 2013 06:00:42 +0000 Subject: [PATCH] Bug 825718: Fix Bugzilla::Bug->check() wrt caching mechanism r=LpSolit,r=LpSolit git-svn-id: svn://10.0.0.236/trunk@264627 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/Bug.pm | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index 7255465b855..a76e593f8ee 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8548 \ No newline at end of file +8549 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm index 7c7e0fb37ca..4485b620c61 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm @@ -372,14 +372,16 @@ sub cache_key { sub check { my $class = shift; - my ($id, $field) = @_; - - ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id; + my ($param, $field) = @_; # Bugzilla::Bug throws lots of special errors, so we don't call # SUPER::check, we just call our new and do our own checks. - $id = trim($id); - my $self = $class->new($id); + my $id = ref($param) + ? ($param->{id} = trim($param->{id})) + : ($param = trim($param)); + ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id; + + my $self = $class->new($param); if ($self->{error}) { # For error messages, use the id that was returned by new(), because