You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/05/23 20:00:46 UTC

[GitHub] [nifi] exceptionfactory commented on pull request #6061: NIFI-5378 prevent duplicate keys with different values in nifi.p…

exceptionfactory commented on PR #6061:
URL: https://github.com/apache/nifi/pull/6061#issuecomment-1135084798

   > @exceptionfactory I get your point about how properties are loaded with the increased flexibility naturally built into the Properties class. The problem with `Properties.load()` is it automatically turns the property keys into a Set which makes it impossible to find duplicates. The only way I thought of to do this was standard FileReader and going line by line. As far as I know, multi-line properties are not supported (and a test case putting a property in a new line verified that behavior.)
   >
   
   The OpenJDK implementation of `java.util.Properties` calls the public `put` method after reading the property and value, so the `put` method could be overridden to check and store duplicate keys, avoiding the need for custom parsing.
   
   https://github.com/openjdk/jdk/blob/f77a658557be193e2deb5cbd5c69e561bb88524b/src/java.base/share/classes/java/util/Properties.java#L457
   
   The standard implementation supports multiline property values using a continuation character as follows:
   
   ```
   nifi.ui.banner.text=Banner \
    Extended
   ```
    
   > I'm not sure the characterset issues you mention are necessarily relevant in the check for duplicates. As long as the property values are being read the same way regardless of UTF-8, ISO-8859-1, etc. then the String compare would still be accurate for match/not match. Please correct me if you still think this is an issue.
   > 
   
   That's a good point about the character set when it comes to comparing values. Although the property value might not match the parsed value, it should still be possible to compare the same byte string.
   
   


-- 
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-unsubscribe@nifi.apache.org

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