[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16129726#comment-16129726 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on the issue: https://github.com/apache/nifi/pull/2093 Thanks a ton for the merge and the git tip, @ijokarumawak!! > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > Fix For: 1.4.0 > > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16129587#comment-16129587 ] ASF subversion and git services commented on NIFI-4062: --- Commit 6df112e4b1c2495d281b1edfce84219e3bea581a in nifi's branch refs/heads/master from [~arunodhaya80] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=6df112e ] NIFI-4062 Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery This closes #2093. Signed-off-by: Koji Kawamura> Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16129588#comment-16129588 ] ASF GitHub Bot commented on NIFI-4062: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2093 > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16129581#comment-16129581 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on the issue: https://github.com/apache/nifi/pull/2093 @arunma Local contrib-check passed successfully. All review comments are addressed. LGTM, +1, merging to master. Thanks again for your contribution! > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16129566#comment-16129566 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on the issue: https://github.com/apache/nifi/pull/2093 @arunma Thanks for the updates. I'm going to build it locally once again just in case. When you rebase or squash the commits, then you need to push to your branch forcefully, for example: ``` # To rebase git checkout master git pull upstream master git checkout git rebase master # To squash (the HEAD~3 indicates how many recent commits you want to rebase) git rebase -i HEAD~3 # After rebase (with latest master, or squash commits), push updated commit to the existing PR with -f option git push -f origin ``` By pushing updates to the existing branch, you don't need to close/open new PR. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128949#comment-16128949 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on the issue: https://github.com/apache/nifi/pull/2093 @ijokarumawak Thanks for all the patience and very useful review. I learnt quite a lot. Is there a way to prevent the PR from closing itself automatically when I tried to reset my master with the latest of the upstream? I feel bad for opening up different PRs like this. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128933#comment-16128933 ] ASF GitHub Bot commented on NIFI-4062: -- GitHub user arunma opened a pull request: https://github.com/apache/nifi/pull/2093 NIFI-4062 Provide an option to disable DTD validation for EvaluateXPa… …th and EvaluateXQuery Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/arunma/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2093.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2093 commit d2032da711a3ee14ddc499baccefe486072b6c51 Author: Arun ManivannanDate: 2017-08-12T05:41:18Z NIFI-4062 Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128919#comment-16128919 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma closed the pull request at: https://github.com/apache/nifi/pull/2080 > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128866#comment-16128866 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133464470 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXPath.java --- @@ -16,23 +16,23 @@ */ package org.apache.nifi.processors.standard; -import static org.junit.Assert.assertTrue; +import org.apache.nifi.util.MockFlowFile; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.Test; +import javax.xml.xpath.XPathFactoryConfigurationException; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import javax.xml.xpath.XPathFactoryConfigurationException; - -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; - -import org.junit.Test; +import static org.junit.Assert.assertTrue; --- End diff -- :-) Absolutely. Fixed it. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128865#comment-16128865 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133464300 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -219,6 +234,25 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } final ComponentLog logger = getLogger(); +final XMLReader xmlReader; + +try { +xmlReader = XMLReaderFactory.createXMLReader(); +} catch (SAXException e) { +logger.error("Error while constructing XMLReader {}", new Object[]{e}); +session.transfer(flowFiles, REL_FAILURE); --- End diff -- Yikes. My bad ! Fixed it. Both throw ProcessException. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128864#comment-16128864 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133464579 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXQuery.java --- @@ -31,19 +35,15 @@ import java.util.Map.Entry; import java.util.Properties; -import javax.xml.transform.OutputKeys; -import javax.xml.xpath.XPathFactoryConfigurationException; - -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.Ignore; - -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; --- End diff -- Fixed it. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128863#comment-16128863 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133464617 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXQuery.java --- @@ -65,7 +65,6 @@ public void testSetTransformerProperties() throws Exception { } } -@Ignore("this test is failing") --- End diff -- Anytime ! > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128254#comment-16128254 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133351212 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -219,6 +234,25 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } final ComponentLog logger = getLogger(); +final XMLReader xmlReader; + +try { +xmlReader = XMLReaderFactory.createXMLReader(); +} catch (SAXException e) { +logger.error("Error while constructing XMLReader {}", new Object[]{e}); +session.transfer(flowFiles, REL_FAILURE); --- End diff -- EvaluateXQuery throws ProcessException. EvaluateXPath should do the same. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128251#comment-16128251 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133350949 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXQuery.java --- @@ -65,7 +65,6 @@ public void testSetTransformerProperties() throws Exception { } } -@Ignore("this test is failing") --- End diff -- Thanks for fixing this :) > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128253#comment-16128253 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133350881 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXPath.java --- @@ -16,23 +16,23 @@ */ package org.apache.nifi.processors.standard; -import static org.junit.Assert.assertTrue; +import org.apache.nifi.util.MockFlowFile; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.Test; +import javax.xml.xpath.XPathFactoryConfigurationException; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import javax.xml.xpath.XPathFactoryConfigurationException; - -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; - -import org.junit.Test; +import static org.junit.Assert.assertTrue; --- End diff -- These import statement change can be cleaner, too. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16128252#comment-16128252 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133350909 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateXQuery.java --- @@ -31,19 +35,15 @@ import java.util.Map.Entry; import java.util.Properties; -import javax.xml.transform.OutputKeys; -import javax.xml.xpath.XPathFactoryConfigurationException; - -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.Ignore; - -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; --- End diff -- These import statement change can be cleaner, too. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127473#comment-16127473 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133234914 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -309,18 +349,18 @@ public void process(final InputStream rawIn) throws IOException { } if (returnType == NODESET) { -List nodeList = (List) result; -if (nodeList.isEmpty()) { +DOMNodeList nodeList = (DOMNodeList) result; +if (nodeList.getLength()==0) { --- End diff -- Fixed by removing the line. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127464#comment-16127464 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133234173 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -219,6 +239,25 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } final ComponentLog logger = getLogger(); +final DocumentBuilderFactory docBuilderFactory=docBuilderFactoryRef.get(); --- End diff -- Removed the line :-) > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127463#comment-16127463 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133234113 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -199,8 +216,11 @@ protected void init(final ProcessorInitializationContext context) { } @OnScheduled -public void initializeXPathFactory() throws XPathFactoryConfigurationException { +public void initializeFactory() throws XPathFactoryConfigurationException { factoryRef.set(XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON)); +final DocumentBuilderFactory docBuilderFactory=DocumentBuilderFactory.newInstance(); --- End diff -- With the new changes, these lines were removed but I'll watch out for spaces around '=' > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127369#comment-16127369 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133217990 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -125,6 +132,14 @@ .defaultValue(RETURN_TYPE_AUTO) .build(); +public static final PropertyDescriptor VALIDATE_DTD = new PropertyDescriptor.Builder() +.name("Validate DTD") +.description("Specifies whether or not the XML content should be validated against the DTD.") +.required(false) --- End diff -- Ah. I didn't foresee the "No value". Thanks. Fixed it. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127366#comment-16127366 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133217585 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -75,10 +45,47 @@ import org.apache.nifi.processor.io.OutputStreamCallback; import org.apache.nifi.stream.io.BufferedInputStream; import org.apache.nifi.stream.io.BufferedOutputStream; +import org.w3c.dom.Document; +import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; +import org.xml.sax.SAXException; -import net.sf.saxon.lib.NamespaceConstant; -import net.sf.saxon.xpath.XPathEvaluator; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import javax.xml.xpath.XPathFactoryConfigurationException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; + +import static javax.xml.xpath.XPathConstants.NODESET; +import static javax.xml.xpath.XPathConstants.STRING; --- End diff -- Thanks a lot for the review @ijokarumawak. I just figured out a way to do it in SAX and the change is much smaller. Passes all the testcases as well. Pushing it along with the other changes in a few minutes. Yes, reverted the imports back and applied only the changes. It's the IDE :-) > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126950#comment-16126950 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133135972 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -125,6 +132,14 @@ .defaultValue(RETURN_TYPE_AUTO) .build(); +public static final PropertyDescriptor VALIDATE_DTD = new PropertyDescriptor.Builder() +.name("Validate DTD") +.description("Specifies whether or not the XML content should be validated against the DTD.") +.required(false) --- End diff -- A select type property with a default value is usually defined as 'required(true)'. If not, 'No value' can be selected from the pull down menu, but it will be overwritten by the default value. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126952#comment-16126952 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133138260 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXQuery.java --- @@ -272,10 +315,9 @@ public void onTrigger(final ProcessContext context, final ProcessSession session public void process(final InputStream rawIn) throws IOException { try (final InputStream in = new BufferedInputStream(rawIn)) { XQueryEvaluator qe = slashExpression.load(); -qe.setSource(new SAXSource(new InputSource(in))); -DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); -dfactory.setNamespaceAware(true); -Document dom = dfactory.newDocumentBuilder().newDocument(); +final Document document=docBuilder.parse(in); +qe.setSource(new DOMSource(document)); +Document dom = docBuilder.newDocument(); --- End diff -- Is there any performance impact by changing from SAX to DOM to evaluate a large XML document? > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126956#comment-16126956 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133137297 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -309,18 +349,18 @@ public void process(final InputStream rawIn) throws IOException { } if (returnType == NODESET) { -List nodeList = (List) result; -if (nodeList.isEmpty()) { +DOMNodeList nodeList = (DOMNodeList) result; +if (nodeList.getLength()==0) { --- End diff -- White space. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126955#comment-16126955 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133133523 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -75,10 +45,47 @@ import org.apache.nifi.processor.io.OutputStreamCallback; import org.apache.nifi.stream.io.BufferedInputStream; import org.apache.nifi.stream.io.BufferedOutputStream; +import org.w3c.dom.Document; +import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; +import org.xml.sax.SAXException; -import net.sf.saxon.lib.NamespaceConstant; -import net.sf.saxon.xpath.XPathEvaluator; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.ErrorListener; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import javax.xml.xpath.XPathFactoryConfigurationException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; + +import static javax.xml.xpath.XPathConstants.NODESET; +import static javax.xml.xpath.XPathConstants.STRING; --- End diff -- I assume these import statement changes are automatically generated by IDE. Is it possible to change only necessary lines of code? > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126951#comment-16126951 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133137100 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -219,6 +239,25 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } final ComponentLog logger = getLogger(); +final DocumentBuilderFactory docBuilderFactory=docBuilderFactoryRef.get(); +final DocumentBuilder docBuilder; +try { +docBuilder = docBuilderFactory.newDocumentBuilder(); + +if (!context.getProperty(VALIDATE_DTD).asBoolean()) { +docBuilder.setEntityResolver(new EntityResolver() { +@Override +public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { +return new InputSource(new StringReader("")); +} +}); +} +} catch (ParserConfigurationException e) { +logger.error("Configuration error while constructing DocumentBuilder {}", new Object[]{e}); +session.transfer(flowFiles, REL_FAILURE); +return; --- End diff -- Throwing ProcessException would be more appropriate here, because the ParserConfigurationException is thrown regardless of incoming FlowFiles. By throwing ProcessException, incoming FlowFiles stay in the queue and can be processed after the user have fixed the issue. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126953#comment-16126953 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133135433 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -219,6 +239,25 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } final ComponentLog logger = getLogger(); +final DocumentBuilderFactory docBuilderFactory=docBuilderFactoryRef.get(); --- End diff -- White space. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126957#comment-16126957 ] ASF GitHub Bot commented on NIFI-4062: -- Github user ijokarumawak commented on a diff in the pull request: https://github.com/apache/nifi/pull/2080#discussion_r133137160 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateXPath.java --- @@ -277,8 +316,9 @@ public void onTrigger(final ProcessContext context, final ProcessSession session @Override public void process(final InputStream rawIn) throws IOException { try (final InputStream in = new BufferedInputStream(rawIn)) { -final List rootList = (List) slashExpression.evaluate(new InputSource(in), NODESET); -sourceRef.set(rootList.get(0)); +final Document document=docBuilder.parse(in); --- End diff -- White space. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124968#comment-16124968 ] Arun Manivannan commented on NIFI-4062: --- [~joewitt] Apologies. I reset my master branch with upstream without realising that the older PR would be closed automatically. Have made a fresh PR. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124967#comment-16124967 ] ASF GitHub Bot commented on NIFI-4062: -- GitHub user arunma opened a pull request: https://github.com/apache/nifi/pull/2080 NIFI-4062 Provide an option to disable DTD validation for EvaluateXPa… …th and EvaluateXQuery Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x] Have you written or updated unit tests to verify your changes? - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/arunma/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2080.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2080 commit 14adaf3713fe9691fd656dd30a215cc5dbdb6267 Author: Arun ManivannanDate: 2017-08-12T05:41:18Z NIFI-4062 Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124959#comment-16124959 ] ASF GitHub Bot commented on NIFI-4062: -- Github user arunma closed the pull request at: https://github.com/apache/nifi/pull/2079 > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124626#comment-16124626 ] Joseph Witt commented on NIFI-4062: --- no problem at all [~arunodhaya80] you did just fine. thanks > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124595#comment-16124595 ] Arun Manivannan commented on NIFI-4062: --- [~joewitt] Sorry about that. Will follow through in my subsequent commits. This is my first contribution. Trying hard to fit myself into the process. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124590#comment-16124590 ] Joseph Witt commented on NIFI-4062: --- Fix version can be applied when we have review traction nearing a merge. Thanks for contributing. > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (NIFI-4062) Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery
[ https://issues.apache.org/jira/browse/NIFI-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16124484#comment-16124484 ] ASF GitHub Bot commented on NIFI-4062: -- GitHub user arunma opened a pull request: https://github.com/apache/nifi/pull/2079 NIFI-4062 Provide an option to disable DTD validation for EvaluateXPa… …th and EvaluateXQuery Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/arunma/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2079.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2079 commit d6d131228c6e9c31bae54c3ea9d733c917b1d7ce Author: Arun ManivannanDate: 2017-08-12T05:41:18Z NIFI-4062 Provide an option to disable DTD validation for EvaluateXPath and EvaluateXQuery > Provide an option to disable DTD validation for EvaluateXPath and > EvaluateXQuery > > > Key: NIFI-4062 > URL: https://issues.apache.org/jira/browse/NIFI-4062 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions >Affects Versions: 1.0.0 >Reporter: Koji Kawamura >Assignee: Arun Manivannan > Labels: beginner > > Currently EvaluateXPath and EvaluateXQuery can fail if the source document > has DOCTYPE definition in it, especially using external DTD. It would be > useful if these processor provides a property to disable DTD validation when > evaluate XPath or XQuery. > References: > https://community.hortonworks.com/questions/107121/does-evaluatexpath-support-doctype.html > https://stackoverflow.com/questions/243728/how-to-disable-dtd-at-runtime-in-javas-xpath -- This message was sent by Atlassian JIRA (v6.4.14#64029)