Closed
Bug 348282
Opened 18 years ago
Closed 18 years ago
importxml.pl throws Bugzilla::Bug::ValidateTime warnings if the time value is not defined and param timetrackinggroup defined.
Categories
(Bugzilla :: Bug Import/Export & Moving, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.22
People
(Reporter: mkanat, Assigned: valorbugzilla)
Details
Attachments
(1 file, 3 obsolete files)
2.02 KB,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
importxml.pl calls Bugzilla::Bug::ValidateTime inside of an eval, to avoid dying. That's fine. However, functions still throw warnings right to STDERR inside of an evail, and this one does, in this case. importxml.pl calls ValidateTime on the three time-tracking fields, but if the exporter wasn't in the timetrackinggroup, ValidateTime will throw the warrning: Use of uninitialized value in pattern match (m//) at Bugzilla/Bug.pm line 775
Reporter | ||
Updated•18 years ago
|
Severity: normal → minor
Assignee | ||
Comment 1•18 years ago
|
||
I'll accept this bug. This apply on 2.22 and the tip. And it does not affect if user is in timetracking group or not. It apply if param timetrackinggroup is defined and one or more of the three values are undefined in the xml file. Patch is checking if ($bug_fields{xxxx} ) for remaining_time, and estimated_time. If not defined eval don't run and value is not pushed into @values neither @query. Then for actual_time I check if defined on eval. Period. Then I check as usual if eval result in error OR for actual_time be undefined. As with actual_time I need to define a valid value in case of undefined or in case of error from eval.
Status: NEW → ASSIGNED
Assignee | ||
Updated•18 years ago
|
Assignee: import-export → gbn
Status: ASSIGNED → NEW
Assignee | ||
Comment 2•18 years ago
|
||
Attachment #254102 -
Flags: review?(LpSolit)
Assignee | ||
Comment 3•18 years ago
|
||
Attachment #254103 -
Flags: review?(LpSolit)
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Summary: importxml.pl throws Bugzilla::Bug::ValidateTime warnings if the exporter was not in the timetrackinggroup → importxml.pl throws Bugzilla::Bug::ValidateTime warnings if the time value is not defined and param timetrackinggroup defined.
Comment 4•18 years ago
|
||
Comment on attachment 254103 [details] [diff] [review] Patch 1.0 for the tip. >--- importxml.pl 2007-02-06 02:55:54.000000000 +0100 >+ if ( $bug_fields{'estimated_time'} ) { >+ eval { >+ Bugzilla::Bug::ValidateTime($bug_fields{'estimated_time'}, "e"); >+ }; 0 is a valid time and should not be excluded. The problem is only when times are undefined. So it should be if (defined $bug_fields{'...'}). >+ if ( $bug_fields{'remaining_time'} ) { Same here. > eval { > Bugzilla::Bug::ValidateTime($bug_fields{'actual_time'}, "a"); >+ } if ( $bug_fields{'actual_time'} ); >+ if ($@ || !$bug_fields{'actual_time'} ) { I prefer a IF block here, because the error message is inaccurate if actual_time is undefined. In this case, it should fallback to 0 without throwing an error. Either that or the error message should mention that we used 0 because no actual_time value was found. This bug is a perfect illustration where: 1) Bug::ValidateTime() should throw an error if $time is undefined, internally, to avoid the error reported here. 2) error_mode == ERROR_MODE_WARN would avoid all these eval {}.
Attachment #254103 -
Flags: review?(LpSolit) → review-
Comment 5•18 years ago
|
||
Comment on attachment 254102 [details] [diff] [review] Patch 1.0 for 2.22-BRANCH r- for the same reason.
Attachment #254102 -
Flags: review?(LpSolit) → review-
Assignee | ||
Comment 6•18 years ago
|
||
I thought the same about Bug::ValidateTime(), didn't offer a patch for it as I've never used time tracking features yet so I really don't know any of the consequences of such change and I'm not willing to spend time finding it out through grep :-). I'm uploading patch for both with the changes you requested.
Assignee | ||
Comment 7•18 years ago
|
||
Attachment #254102 -
Attachment is obsolete: true
Attachment #254157 -
Flags: review?(LpSolit)
Assignee | ||
Comment 8•18 years ago
|
||
Attachment #254103 -
Attachment is obsolete: true
Attachment #254158 -
Flags: review?(LpSolit)
Comment 9•18 years ago
|
||
(In reply to comment #6) > I thought the same about Bug::ValidateTime(), didn't offer a patch for it as > I've never used time tracking features yet so I really don't know any of the > consequences of such change and I'm not willing to spend time finding it out > through grep :-). I checked, it's safe as callers already do this check themselves.
Comment 10•18 years ago
|
||
Comment on attachment 254158 [details] [diff] [review] Patch 1.1 for the tip >+ else { > $bug_fields{'actual_time'} = 0.0; >+ $err .= "Actual time not comming. Setting to 0.0\n"; Nit: "Actual time not defined" is better than "not comming". To be fixed on checkin. r=LpSolit
Attachment #254158 -
Flags: review?(LpSolit) → review+
Comment 11•18 years ago
|
||
Comment on attachment 254157 [details] [diff] [review] Patch 1.1 for 2.22-BRANCH No need to attach a separate backport if it's exactly the same patch as the one for the trunk.
Attachment #254157 -
Attachment is obsolete: true
Attachment #254157 -
Flags: review?(LpSolit)
Updated•18 years ago
|
Flags: approval2.22+
Flags: approval+
Target Milestone: --- → Bugzilla 2.22
Comment 12•18 years ago
|
||
tip: Checking in importxml.pl; /cvsroot/mozilla/webtools/bugzilla/importxml.pl,v <-- importxml.pl new revision: 1.74; previous revision: 1.73 done 2.22.2: Checking in importxml.pl; /cvsroot/mozilla/webtools/bugzilla/importxml.pl,v <-- importxml.pl new revision: 1.47.2.9; previous revision: 1.47.2.8 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•