NIFI-1660: Addressed formatting issue, closed Reader in TestQuery; updated 
NOTICE files of NARs. This closes #303


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/b8ff203c
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/b8ff203c
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/b8ff203c

Branch: refs/heads/0.x
Commit: b8ff203c003f27933584515ab48842e87d5b5149
Parents: f44048e
Author: Mark Payne <[email protected]>
Authored: Tue Jun 7 16:00:57 2016 -0400
Committer: Mark Payne <[email protected]>
Committed: Tue Jun 7 16:00:57 2016 -0400

----------------------------------------------------------------------
 .../attribute/expression/language/Query.java    |  5 ++-
 .../expression/language/TestQuery.java          | 34 +++++++++-----------
 .../src/main/resources/META-INF/NOTICE          |  8 +++++
 .../src/main/resources/META-INF/NOTICE          |  8 +++++
 4 files changed, 34 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/b8ff203c/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
----------------------------------------------------------------------
diff --git 
a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
 
b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
index c5486cf..d39f0f8 100644
--- 
a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
+++ 
b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/Query.java
@@ -1359,9 +1359,8 @@ public class Query {
                 return addToken(new 
JsonPathEvaluator(toStringEvaluator(subjectEvaluator),
                         toStringEvaluator(argEvaluators.get(0), "first 
argument to jsonPath")), "jsonPath");
             }
-                default:
-                throw new AttributeExpressionLanguageParsingException(
-                        "Expected a Function-type expression but got " + 
tree.toString());
+            default:
+                throw new 
AttributeExpressionLanguageParsingException("Expected a Function-type 
expression but got " + tree.toString());
             }
     }
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/b8ff203c/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
----------------------------------------------------------------------
diff --git 
a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
 
b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
index 39622cb..05bd017 100644
--- 
a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
+++ 
b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
@@ -241,7 +241,7 @@ public class TestQuery {
     }
 
     @Test
-    public void testJsonPath() {
+    public void testJsonPath() throws IOException {
         final Map<String, String> attributes = new HashMap<>();
         attributes.put("json", getResourceAsString("/json/address-book.json"));
         verifyEquals("${json:jsonPath('$.firstName')}", attributes, "John");
@@ -1315,24 +1315,22 @@ public class TestQuery {
         assertEquals(expectedResult, result.getValue());
     }
 
-    private String getResourceAsString(String resourceName) {
-        Reader reader = new InputStreamReader(new 
BufferedInputStream(getClass().getResourceAsStream(resourceName)));
-        int n = 0;
-        char[] buf = new char[1024];
-        StringBuilder sb = new StringBuilder();
-        while (n != -1) {
-            try {
-                n = reader.read(buf, 0, buf.length);
-            } catch (IOException e) {
-                throw new RuntimeException("failed to read resource", e);
-            }
-            if (n > 0) {
-                sb.append(buf, 0, n);
+    private String getResourceAsString(String resourceName) throws IOException 
{
+        try (final Reader reader = new InputStreamReader(new 
BufferedInputStream(getClass().getResourceAsStream(resourceName)))) {
+            int n = 0;
+            char[] buf = new char[1024];
+            StringBuilder sb = new StringBuilder();
+            while (n != -1) {
+                try {
+                    n = reader.read(buf, 0, buf.length);
+                } catch (IOException e) {
+                    throw new RuntimeException("failed to read resource", e);
+                }
+                if (n > 0) {
+                    sb.append(buf, 0, n);
+                }
             }
+            return sb.toString();
         }
-        return sb.toString();
-
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/b8ff203c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE
index 7d75d86..5d3fa07 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework-nar/src/main/resources/META-INF/NOTICE
@@ -100,6 +100,14 @@ The following binary components are provided under the 
Apache Software License v
       Swagger Core 1.5.3-M1
       Copyright 2015 Reverb Technologies, Inc.
 
+  (ASLv2) JSON-SMART
+    The following NOTICE information applies:
+      Copyright 2011 JSON-SMART authors
+
+  (ASLv2) JsonPath
+    The following NOTICE information applies:
+      Copyright 2011 JsonPath authors
+
 ************************
 Common Development and Distribution License 1.1
 ************************

http://git-wip-us.apache.org/repos/asf/nifi/blob/b8ff203c/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-nar/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-nar/src/main/resources/META-INF/NOTICE
 
b/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-nar/src/main/resources/META-INF/NOTICE
index 419dc19..1e90f9f 100644
--- 
a/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-nar/src/main/resources/META-INF/NOTICE
+++ 
b/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-nar/src/main/resources/META-INF/NOTICE
@@ -17,3 +17,11 @@ The following binary components are provided under the 
Apache Software License v
 
       This product includes software from the Spring Framework,
       under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+
+  (ASLv2) JSON-SMART
+    The following NOTICE information applies:
+      Copyright 2011 JSON-SMART authors
+
+  (ASLv2) JsonPath
+    The following NOTICE information applies:
+      Copyright 2011 JsonPath authors

Reply via email to