xiangfu0 commented on code in PR #15648: URL: https://github.com/apache/pinot/pull/15648#discussion_r2135334331
########## pinot-spi/src/main/java/org/apache/pinot/spi/env/CommonsConfigurationUtils.java: ########## @@ -170,6 +178,34 @@ public static PropertiesConfiguration fromFile(@Nullable File file, return config; } + /** + * Instantiate a {@link PropertiesConfiguration} from a {@link File}. + * @param file containing properties + * @param setDefaultDelimiter representing to set the default list delimiter. + * @param ioFactoryKind representing to set IOFactory. It can be null. + * @param failOnDuplicateKeys fail the loading when seeing duplicate keys. + * @return a {@link PropertiesConfiguration} instance. + */ + public static PropertiesConfiguration fromFile(@Nullable File file, boolean setDefaultDelimiter, + @Nullable PropertyIOFactoryKind ioFactoryKind, boolean failOnDuplicateKeys) + throws ConfigurationException { + if (failOnDuplicateKeys) { + PropertiesConfiguration noDuplicateKeysConfig = createNoDuplicateKeysPropertiesConfiguration(ioFactoryKind); + // check if file exists, load the existing properties. + if (file != null && file.exists()) { + FileHandler fileHandler = new FileHandler(noDuplicateKeysConfig); + fileHandler.load(file); + } + PropertiesConfiguration finalConfig = createPropertiesConfiguration(setDefaultDelimiter, ioFactoryKind); Review Comment: fileHandler.load(file) to an immutable properties. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org