Lehel44 commented on a change in pull request #5437:
URL: https://github.com/apache/nifi/pull/5437#discussion_r725132050



##########
File path: 
nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
##########
@@ -674,39 +681,33 @@ protected Path getNormalizedPath(ProcessContext context, 
PropertyDescriptor prop
     }
 
     protected Path getNormalizedPath(final String rawPath) {
-        final Path path = new Path(rawPath);
-        final URI uri = path.toUri();
-
-        final URI fileSystemUri = getFileSystem().getUri();
-
-        if (uri.getScheme() != null) {
-            if (!uri.getScheme().equals(fileSystemUri.getScheme()) || 
!uri.getAuthority().equals(fileSystemUri.getAuthority())) {
-                getLogger().warn("The filesystem component of the URI 
configured ({}) does not match the filesystem URI from the Hadoop configuration 
file ({}) " +
-                        "and will be ignored.", uri, fileSystemUri);
-            }
-
-            return new Path(uri.getPath());
-        } else {
-            return path;
-        }
+       return getNormalizedPath(rawPath, Optional.empty());
     }
 
     protected Path getNormalizedPath(final ProcessContext context, final 
PropertyDescriptor property, final FlowFile flowFile) {
         final String propertyValue = 
context.getProperty(property).evaluateAttributeExpressions(flowFile).getValue();
-        final Path path = new Path(propertyValue);
-        final URI uri = path.toUri();
+        return getNormalizedPath(propertyValue, 
Optional.of(property.getDisplayName()));
+    }
 
+    private Path getNormalizedPath(final String rawPath, final 
Optional<String> propertyName) {

Review comment:
       What do you think of removing the optional from the method parameter? I 
think it could be a simple string with a null check. If I remember well 
optionals are not meant to be used as parameters because they introduce a new 
object state: null, not empty, empty instead of null and not null. I think in 
this case passing null to this method would be fine, and I could also find 
several examples in the code where null was passed as flowfile.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to