exceptionfactory commented on a change in pull request #5254:
URL: https://github.com/apache/nifi/pull/5254#discussion_r686934239
##########
File path:
nifi-stateless/nifi-stateless-api/src/main/java/org/apache/nifi/stateless/config/PropertiesFileEngineConfigurationParser.java
##########
@@ -85,6 +87,9 @@ public StatelessEngineConfiguration
parseEngineConfiguration(final File properti
throw new StatelessConfigurationException("Extensions Directory "
+ narDirectory.getAbsolutePath() + " specified in properties file does not
exist and could not be created");
}
+ final String contentRepoDirectoryFilename =
properties.getProperty(CONTENT_REPO_DIRECTORY);
+ final File contentRepoDirectory = contentRepoDirectoryFilename == null
? null : new File(contentRepoDirectoryFilename);
Review comment:
With the addition of an empty property in `stateless.properties`, the
value of `contentRepoDirectoryFilename` no longer evaluates to `null`. As a
result, the default configuration of `stateless.properties` causes the
following `IOException`:
```
Exception in thread "main" java.io.IOException: Cannot initialize Content
Repository because /opt/nifi-stateless-1.15.0-SNAPSHOT does not exist and
cannot be created
at
org.apache.nifi.stateless.repository.StatelessFileSystemContentRepository.initialize(StatelessFileSystemContentRepository.java:75)
at
org.apache.nifi.stateless.flow.StandardStatelessDataflowFactory.createDataflow(StandardStatelessDataflowFactory.java:216)
at
org.apache.nifi.stateless.bootstrap.StatelessBootstrap.createDataflow(StatelessBootstrap.java:66)
at
org.apache.nifi.stateless.bootstrap.RunStatelessFlow.createDataflow(RunStatelessFlow.java:94)
at
org.apache.nifi.stateless.bootstrap.RunStatelessFlow.main(RunStatelessFlow.java:56)
```
Changing this check to return a default empty string and checking the length
seems like one potential solution.
```suggestion
final String contentRepoDirectoryFilename =
properties.getProperty(CONTENT_REPO_DIRECTORY, "");
final File contentRepoDirectory =
contentRepoDirectoryFilename.isEmpty() ? null : new
File(contentRepoDirectoryFilename);
```
--
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]