NullPointerException when using 'includes' with XLIFF project type
Description
Environment
Activity
Sean Flanigan 13 April 2016 at 07:06
Unfortunately, the existing code for non-FILE projects in zanata client is quite strongly tied to having a fixed, known extension for each file type: .xml in the case of XLIFF projects.
The generic FILE project type already has support for custom file extensions and multiple file extensions, so the plan is to improve the FILE project type to handle XLIFF better. See ZNTA-1023, https://zanata.atlassian.net/browse/ZNTA-1021#icft=ZNTA-1021 and ZNTA-1025.
Sean Flanigan 7 April 2016 at 07:47
For a workaround, see https://zanata.atlassian.net/browse/ZNTA-610?focusedCommentId=16804&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16804 (but you will currently need to add --validate CONTENT
).
Sean Flanigan 7 April 2016 at 07:44
Looking at the code, this happens because the generic 'includes' option specifies the pattern "*.xliff", but XliffStrategy.loadSrcDoc
can only handle files with extension ".xml". So if there are any files in the directory which match *.xliff, they eventually trigger a NullPointerException inside JDK code.
Details
Assignee
Sean FlaniganSean FlaniganReporter
Sean FlaniganSean FlaniganAffects versions
Priority
unspecified
Details
Details
Assignee
Reporter
Affects versions
Priority

(Extracted from @Brad Garrison's comments against ZNTA-923.)
I'm using zanata-cli and am getting a java.lang.NullPointerException when trying to upload source documents.
###
zanata.xml for the project is as follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
<url>http://[servername]/zanata/</url>
<project>synapse_xliff</project>
<project-version>XLIFF</project-version>
<project-type>xliff</project-type>
<src-dir>src</src-dir>
<trans-dir>trans</trans-dir>
<includes>*.xliff</includes>
<rules/>
</config>
###
Results in errors:
[ERROR] Execution failed:
java.lang.RuntimeException
at org.zanata.client.commands.push.PushCommand.pushCurrentModule(PushCommand.java:458)
at org.zanata.client.commands.push.PushCommand.run(PushCommand.java:212)
at org.zanata.client.commands.ConfigurableCommand.runWithActions(ConfigurableCommand.java:110)
at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:48)
at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:170)
at org.zanata.client.ZanataClient.main(ZanataClient.java:95)
Caused by: java.lang.NullPointerException
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.zanata.adapter.xliff.XliffReader.extractXliff(XliffReader.java:126)
at org.zanata.adapter.xliff.XliffReader.extractTemplate(XliffReader.java:69)
at org.zanata.client.commands.push.XliffStrategy.loadSrcDoc(XliffStrategy.java:78)
at org.zanata.client.commands.push.PushCommand.pushCurrentModule(PushCommand.java:392)
... 5 more
###
I do get this warning, though I am unsure if it is relevant.
[WARN] client API version is 3.8.3, but server API version is 3.7.3
###
zanata-cli version information:
zanata-cli
Client version: 3.8.1
Client timestamp: 20151120-1015
Client SCM describe: git-client-3.8.1
API version: 3.8.3
API timestamp: 20151119-2300
API SCM describe: git-api-3.8.3