[jira] [Commented] (NIFI-1893) Add processor for validating JSON

2018-12-25 Thread HondaWei (JIRA)


[ 
https://issues.apache.org/jira/browse/NIFI-1893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16728910#comment-16728910
 ] 

HondaWei commented on NIFI-1893:


HiĀ [~khill] and [~samox]

Sorry for late reply. I've sent a pull request NIFI-1893. This is my first 
contribution to NiFi and please gives me some suggestion.

> Add processor for validating JSON
> -
>
> Key: NIFI-1893
> URL: https://issues.apache.org/jira/browse/NIFI-1893
> Project: Apache NiFi
>  Issue Type: New Feature
>Reporter: Matt Burgess
>Priority: Major
> Attachments: image-2018-12-07-18-02-52-813.png
>
>
> NiFi has a ValidateXml processor to validate incoming XML files against a 
> schema. It would be good to have one to validate JSON files as well.
> For example, an input JSON of:
> {
>   name: "Test",
>   timestamp: 1463499695,
>   tags: {
>"host": "Test_1",
>"ip" : "1.1.1.1"
>   },
>   fields: {
> "cpu": 10.2,
> "load": 15.6
>   }
> }
> Could be validated successfully against the following "schema":
> {
>   "type": "object",
>   "required": ["name", "tags", "timestamp", "fields"],
>   "properties": {
> "name": {"type": "string"},
> "timestamp": {"type": "integer"},
> "tags": {"type": "object", "items": {"type": "string"}},
> "fields": { "type": "object"}
>   }
> }
> There is at least one ASF-friendly library that could be used for 
> implementation: https://github.com/everit-org/json-schema



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] avseq1234 opened a new pull request #3235: Nifi 1893

2018-12-25 Thread GitBox
avseq1234 opened a new pull request #3235: Nifi 1893
URL: https://github.com/apache/nifi/pull/3235
 
 
   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.
   
   - [ ] 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:
   - [ ] 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?
   - [ ] 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.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] avseq1234 closed pull request #3235: Nifi 1893

2018-12-25 Thread GitBox
avseq1234 closed pull request #3235: Nifi 1893
URL: https://github.com/apache/nifi/pull/3235
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-nar/pom.xml 
b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-nar/pom.xml
new file mode 100644
index 00..50b1ee46ce
--- /dev/null
+++ b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-nar/pom.xml
@@ -0,0 +1,41 @@
+
+
+http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+4.0.0
+
+
+org.apache.nifi
+nifi-validator-bundles
+1.8.0-SNAPSHOT
+
+
+nifi-validator-nar
+1.0-SNAPSHOT
+nar
+
+true
+true
+
+
+
+
+org.apache.nifi
+nifi-validator-processors
+1.8.0-SNAPSHOT
+
+
+
+
diff --git 
a/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/pom.xml 
b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/pom.xml
new file mode 100644
index 00..ddfaf0108c
--- /dev/null
+++ b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/pom.xml
@@ -0,0 +1,65 @@
+
+
+http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+4.0.0
+
+
+org.apache.nifi
+nifi-validator-bundles
+1.8.0-SNAPSHOT
+
+
+nifi-validator-processors
+jar
+
+
+
+org.apache.nifi
+nifi-api
+
+
+org.apache.nifi
+nifi-utils
+1.8.0
+
+
+org.apache.nifi
+nifi-mock
+1.8.0
+test
+
+
+org.slf4j
+slf4j-simple
+test
+
+
+junit
+junit
+test
+
+
+com.github.fge
+json-schema-validator
+2.2.6
+
+
+commons-io
+commons-io
+2.6
+
+
+
diff --git 
a/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/src/main/java/org/apache/nifi/processors/validator/NiFiJsonValidator.java
 
b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/src/main/java/org/apache/nifi/processors/validator/NiFiJsonValidator.java
new file mode 100644
index 00..408862cba7
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-validator-bundles/nifi-validator-processors/src/main/java/org/apache/nifi/processors/validator/NiFiJsonValidator.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.validator;
+
+import com.github.fge.jackson.JsonLoader;
+import com.github.fge.jsonschema.core.report.ProcessingReport;
+import com.github.fge.jsonschema.main.JsonSchemaFactory;
+import org.apache.commons.io.IOUtils;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.annotation.behavior.ReadsAttribute;
+import org.apache.nifi.annotation.behavior.ReadsAttributes;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.SeeAlso;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import 

[GitHub] avseq1234 commented on issue #3235: Nifi 1893

2018-12-25 Thread GitBox
avseq1234 commented on issue #3235: Nifi 1893
URL: https://github.com/apache/nifi/pull/3235#issuecomment-449917022
 
 
   This is my first version of JSON Validator. Please review it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] avseq1234 opened a new pull request #3235: Nifi 1893

2018-12-25 Thread GitBox
avseq1234 opened a new pull request #3235: Nifi 1893
URL: https://github.com/apache/nifi/pull/3235
 
 
   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.
   
   - [ ] 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:
   - [ ] 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?
   - [ ] 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.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (NIFI-5894) FTPTransfer NullPointerException - FTPFile.getTimestamp() returns null

2018-12-25 Thread Eric Ulicny (JIRA)


[ 
https://issues.apache.org/jira/browse/NIFI-5894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16728822#comment-16728822
 ] 

Eric Ulicny commented on NIFI-5894:
---

Code updated based on PR comments.

> FTPTransfer NullPointerException - FTPFile.getTimestamp() returns null
> --
>
> Key: NIFI-5894
> URL: https://issues.apache.org/jira/browse/NIFI-5894
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.8.0
>Reporter: henning ottesen
>Assignee: Eric Ulicny
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> 2018-12-13 10:34:07,405 WARN [Timer-Driven Process Thread-2] 
> o.a.n.controller.tasks.ConnectableTask Administratively Yielding 
> ListFTP[id=a6cee9c8-0167-1000-2bc2-5e69d2e33af5] due to uncaught Exception: 
> java.lang.NullPointerException java.lang.NullPointerException: null
>   at 
> org.apache.nifi.processors.standard.util.FTPTransfer.newFileInfo(FTPTransfer.java:305)
>   at 
> org.apache.nifi.processors.standard.util.FTPTransfer.getListing(FTPTransfer.java:270)
>   at 
> org.apache.nifi.processors.standard.util.FTPTransfer.getListing(FTPTransfer.java:260)
>   at 
> org.apache.nifi.processors.standard.util.FTPTransfer.getListing(FTPTransfer.java:191)
>   at 
> org.apache.nifi.processors.standard.ListFileTransfer.performListing(ListFileTransfer.java:106)
>   at 
> org.apache.nifi.processor.util.list.AbstractListProcessor.listByTrackingTimestamps(AbstractListProcessor.java:471)
>   at 
> org.apache.nifi.processor.util.list.AbstractListProcessor.onTrigger(AbstractListProcessor.java:413)
>   at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>   at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
>   at 
> org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
>   at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
>   at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>   at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>   at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>   at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>   at java.lang.Thread.run(Thread.java:748)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)