Error when importing via importxml.pl when <version> is not specified

NEW
Unassigned

Status

()

--
minor
11 years ago
11 years ago

People

(Reporter: yusufm, Unassigned)

Tracking

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: bugzilla-3.0.2

When importing a previously exported bug via XML using importxml.pl, we receive the following error:

Bad argument name sent to
    Bugzilla::Version::new function.

When the XML file does not contain a <version></version> tag. Other missing tags are handled gracefully (e.g. <bug_severity> ), and the importer uses the set default values.

This only happens when the <version> tag is missing. It will work if there is a invalid value specified, in which case, the import will use the default "unspecified" value.

Reproducible: Always

Steps to Reproduce:
1. Export a bug to XML file.
2. Remove (if not already missing) the <version> tag.
3. Use importxml.pl to import the XML file back in.
Actual Results:  
Bad argument name sent to
    Bugzilla::Version::new function.

Expected Results:  
Should use the default value set (e.g. "unspecified") if the value is missing.

Comment 1

11 years ago
Gregary, what's your opinion on it? Version should always be defined as there is no version by default. As this error can only be generated by an invalid XML file, I would suggest to close this bug as WONTFIX, unless you want a fallback (in which case you would have to define one for each field??).
Severity: normal → minor
OS: Linux → All
Version: unspecified → 3.0.2

Comment 2

11 years ago
This is ambiguous, I agree. It should do one or the other, either throw an error in all cases where a proper version is not found, or go with a guess, not unlike the way enter_bug guesses the version. It is probably safer when importing to throw an error, as new bugs are more likely to be for the latest versions, where imports could come from anywhere. 

However, I have to agree with LpSolit in that in the case that the XML is missing a version tag, it is not complying with the DTD which means there is no telling what might happen. Better to make sure the document matches in the first place. However, I will take a look at changing the behavior.
Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.