afs commented on code in PR #3321:
URL: https://github.com/apache/jena/pull/3321#discussion_r2217908154


##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/mod/admin/FMod_Admin.java:
##########
@@ -145,21 +148,32 @@ public void prepare(FusekiServer.Builder builder, 
Set<String> datasetNames, Mode
         String configDir = FusekiServerCtl.dirConfiguration.toString();
         List<DataAccessPoint> directoryDatabases = 
FusekiConfig.readConfigurationDirectory(configDir);
 
+        // Check there are no collisions between the command line 
(datasetNames)
+        // and existing configurations.
         if ( directoryDatabases.isEmpty() && datasetNames.isEmpty() )
             FmtLog.info(LOG, "No databases: dir=%s", configDir);
         else {
+            if ( ! datasetNames.isEmpty() ) {
+                // Check no clashes of command line and configuration
+                Set<String> directoryDatabasesNames = 
directoryDatabases.stream().map(dap->dap.getName()).collect(Collectors.toSet());
+                Set<String> both = SetUtils.intersection(datasetNames, 
directoryDatabasesNames);
+                if ( ! both.isEmpty() ) {
+                    StringJoiner sj = new StringJoiner(", ");
+                    both.forEach(sj::add);
+                    String dups = sj.toString();
+                    //both.forEach(dbName -> FmtLog.error(LOG, "Duplicate 
database '%s' (command line and existing configuration)", dbName));
+                    throw new FusekiConfigException("Duplicate database 
entries for "+dups);

Review Comment:
   Changed.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to