You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2022/01/20 17:57:26 UTC

[nifi] branch main updated (ccd47de -> 695c3aa)

This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git.


    from ccd47de  NIFI-9587 Added JSON format for Prometheus Flow Metrics
     new 0da3994  NIFI-9606 This closes #5688. Removed nifi-security-utils from nifi-framework-api
     new 695c3aa  NIFI-9593 - This closes #5679. Missing catch clauses in Confluent Schema Registry client

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nifi-framework-api/pom.xml                         |  6 ---
 .../client/RestSchemaRegistryClient.java           | 60 ++++++++++++----------
 2 files changed, 34 insertions(+), 32 deletions(-)

[nifi] 02/02: NIFI-9593 - This closes #5679. Missing catch clauses in Confluent Schema Registry client

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 695c3aabcb920668b5bc89134b1614e8dbc99c76
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Wed Jan 19 17:17:40 2022 +0100

    NIFI-9593 - This closes #5679. Missing catch clauses in Confluent Schema Registry client
    
    Signed-off-by: Joe Witt <jo...@apache.org>
---
 .../client/RestSchemaRegistryClient.java           | 60 ++++++++++++----------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
index 3bc663c..bc09ab0 100644
--- a/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
+++ b/nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java
@@ -151,46 +151,54 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient {
             }
 
         } catch (SchemaNotFoundException e) {
-            logger.debug("Could not find schema name in registry by id in: " + schemaPath);
+            logger.debug("Could not find schema metadata in registry by id and subjects in: " + schemaPath);
         }
 
         // Get all couples (subject name, version) for a given schema ID
         // GET /schemas/ids/{int: id}/versions
         if(completeSchema == null) {
-            JsonNode subjectsVersions = fetchJsonResponse(schemaPath + "/versions", "schema name");
-
-            if(subjectsVersions != null) {
-                final ArrayNode subjectsVersionsList = (ArrayNode) subjectsVersions;
-                // we want to make sure we get the latest version
-                int maxVersion = 0;
-                String subjectName = null;
-                for (JsonNode subjectVersion: subjectsVersionsList) {
-                    int currentVersion = subjectVersion.get(VERSION_FIELD_NAME).asInt();
-                    String currentSubjectName = subjectVersion.get(SUBJECT_FIELD_NAME).asText();
-                    if(currentVersion > maxVersion) {
-                        maxVersion = currentVersion;
-                        subjectName = currentSubjectName;
+            try {
+                JsonNode subjectsVersions = fetchJsonResponse(schemaPath + "/versions", "schema name");
+
+                if(subjectsVersions != null) {
+                    final ArrayNode subjectsVersionsList = (ArrayNode) subjectsVersions;
+                    // we want to make sure we get the latest version
+                    int maxVersion = 0;
+                    String subjectName = null;
+                    for (JsonNode subjectVersion: subjectsVersionsList) {
+                        int currentVersion = subjectVersion.get(VERSION_FIELD_NAME).asInt();
+                        String currentSubjectName = subjectVersion.get(SUBJECT_FIELD_NAME).asText();
+                        if(currentVersion > maxVersion) {
+                            maxVersion = currentVersion;
+                            subjectName = currentSubjectName;
+                        }
                     }
-                }
 
-                if(subjectName != null) {
-                    return createRecordSchema(subjectName, maxVersion, schemaId, schemaJson.get(SCHEMA_TEXT_FIELD_NAME).asText());
+                    if(subjectName != null) {
+                        return createRecordSchema(subjectName, maxVersion, schemaId, schemaJson.get(SCHEMA_TEXT_FIELD_NAME).asText());
+                    }
                 }
+            } catch (SchemaNotFoundException e) {
+                logger.debug("Could not find schema metadata in registry by id and versions in: " + schemaPath);
             }
         }
 
         // Last resort option: we get the full list of subjects and check one by one to get the complete schema info
         if(completeSchema == null) {
-            final JsonNode subjectsAllJson = fetchJsonResponse("/subjects", "subjects array");
-            final ArrayNode subjectsAllList = (ArrayNode) subjectsAllJson;
-            for (JsonNode subject: subjectsAllList) {
-                try {
-                    final String searchName = subject.asText();
-                    completeSchema = postJsonResponse("/subjects/" + searchName, schemaJson, "schema id: " + schemaId);
-                    break;
-                } catch (SchemaNotFoundException e) {
-                    continue;
+            try {
+                final JsonNode subjectsAllJson = fetchJsonResponse("/subjects", "subjects array");
+                final ArrayNode subjectsAllList = (ArrayNode) subjectsAllJson;
+                for (JsonNode subject: subjectsAllList) {
+                    try {
+                        final String searchName = subject.asText();
+                        completeSchema = postJsonResponse("/subjects/" + searchName, schemaJson, "schema id: " + schemaId);
+                        break;
+                    } catch (SchemaNotFoundException e) {
+                        continue;
+                    }
                 }
+            } catch (SchemaNotFoundException e) {
+                logger.debug("Could not find schema metadata in registry by iterating through subjects");
             }
         }
 

[nifi] 01/02: NIFI-9606 This closes #5688. Removed nifi-security-utils from nifi-framework-api

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 0da3994ac890c3cec4d5ca12c1debea2e4016669
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Thu Jan 20 10:17:09 2022 -0600

    NIFI-9606 This closes #5688. Removed nifi-security-utils from nifi-framework-api
    
    Signed-off-by: Joe Witt <jo...@apache.org>
---
 nifi-framework-api/pom.xml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/nifi-framework-api/pom.xml b/nifi-framework-api/pom.xml
index cbcfcee..631897c 100644
--- a/nifi-framework-api/pom.xml
+++ b/nifi-framework-api/pom.xml
@@ -29,11 +29,5 @@
             <artifactId>nifi-api</artifactId>
             <version>1.16.0-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.nifi</groupId>
-            <artifactId>nifi-security-utils</artifactId>
-            <version>1.16.0-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 </project>