Bug 886711 - Error when using pull for project type raw when the document name does not include a type extension
Summary: Error when using pull for project type raw when the document name does not in...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Maven
Version: 2.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: 2.1
Assignee: David Mason
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks: 864277 864280
TreeView+ depends on / blocked
 
Reported: 2012-12-12 23:38 UTC by David Mason
Modified: 2013-02-26 04:06 UTC (History)
1 user (show)

Fixed In Version: 2.1-SNAPSHOT (20121214-0032)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-26 04:06:14 UTC


Attachments (Terms of Use)

Description David Mason 2012-12-12 23:38:14 UTC
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:
Always


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= -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 05:28:00 UTC
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 07:53:58 UTC
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.