simonbence commented on a change in pull request #5437:
URL: https://github.com/apache/nifi/pull/5437#discussion_r724969241
##########
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) {
+ final URI uri = new Path(rawPath).toUri();
final URI fileSystemUri = getFileSystem().getUri();
+ final String path;
if (uri.getScheme() != null) {
if (!uri.getScheme().equals(fileSystemUri.getScheme()) ||
!uri.getAuthority().equals(fileSystemUri.getAuthority())) {
- getLogger().warn("The filesystem component of the URI
configured in the '{}' property ({}) does not match the filesystem URI from the
Hadoop configuration file ({}) " +
- "and will be ignored.", property.getDisplayName(),
uri, fileSystemUri);
+ if (propertyName.isPresent()) {
Review comment:
Good finding and a poor choice of test data on my part. I add a case
which does not provide false positive. However, I keep the current test in
order to prevent regression.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]