Bug 886711 - Error when using pull for project type raw when the document name does not include a type extension
Error when using pull for project type raw when the document name does not in...
Product: Zanata
Classification: Community
Component: Component-Maven (Show other bugs)
Unspecified Unspecified
medium Severity high
: ---
: 2.1
Assigned To: David Mason
Ding-Yi Chen
Depends On:
Blocks: 864277 864280
  Show dependency treegraph
Reported: 2012-12-12 18:38 EST by David Mason
Modified: 2013-02-25 23:06 EST (History)
1 user (show)

See Also:
Fixed In Version: 2.1-SNAPSHOT (20121214-0032)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-25 23:06:14 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Mason 2012-12-12 18:38:14 EST
Description of problem:
When using pull command with projectType=raw, if the project contains any documents that have been uploaded as raw documents, but the document name does not include an extension matching the type, a 500 error (caused by NullPointerException) is returned by the server.

Version-Release number of selected component (if applicable):
Server version 2.0.3

How reproducible:

Steps to Reproduce:
1. Use curl to upload a raw document under a name with no extension
     e.g. curl -F type=txt -F file=@document.txt -F hash=`md5sum document.txt | awk '{print $1}'`   -F first=true -F last=true   -H "X-Auth-User:USERNAME" -H "X-Auth-Token:API_KEY"    "SERVER/rest/file/source/PROJECT_SLUG/VERSION_SLUG?docId=document

     Note: docId=document has no file extension

2. Download zanata.xml for the project-version and ensure project type is raw (e.g. <project-type>raw</project-type>
3. From the directory containing zanata.xml, run zanata pull command (e.g. mvn zanata:pull)
Actual results:
500 internal server error when the process reaches the document from step 1. Some documents that have a matching extension may be pulled successfully, depending on the order that the documents are pulled.

Expected results:
All documents pulled successfully, regardless of document name.

Additional info:
Caused by use of document name to look up a file format adapter. Should use document type from database.
Comment 1 David Mason 2012-12-13 00:28:00 EST
Fixed in 2.1-SNAPSHOT. Generation of translated raw documents now uses document type from the database to select an appropriate adapter.

See: https://github.com/zanata/zanata/commit/22d5e22cd6bafd4df060587a6eb6141bb75dbd4d
Comment 2 Ding-Yi Chen 2012-12-14 02:53:58 EST
VERIFIED with Zanata version 2.1-SNAPSHOT (20121214-0032)

Note You need to log in before you can comment on or make changes to this bug.