Skip to content

Commit b4db49a

Browse files
authored
GH-4401 bug fix for configuration handling with new vocab (#4935)
2 parents 14a62d9 + cb631be commit b4db49a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

core/repository/manager/src/main/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManager.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ public synchronized RepositoryConfig getRepositoryConfig(String id) {
276276
throw new RepositoryConfigException("Wrong repository ID in configuration: " + configFile);
277277
}
278278
var config = RepositoryConfigUtil.getRepositoryConfig(model, repositoryID);
279-
if (Configurations.hasLegacyConfiguration(model) && !Configurations.useLegacyConfig()) {
280-
logger.warn("configuration for {} uses legacy vocabulary, converting.", id);
281-
addRepositoryConfig(config);
279+
if (Configurations.hasLegacyConfiguration(model) && !Configurations.useLegacyConfig()
280+
&& config != null) {
281+
migrateToNewConfigVocabulary(config);
282282
}
283283
return config;
284284
} catch (IOException e) {
@@ -288,6 +288,19 @@ public synchronized RepositoryConfig getRepositoryConfig(String id) {
288288
return null;
289289
}
290290

291+
/**
292+
* Migrate a repository configuration from the legacy vocabulary to the new vocabulary in
293+
* {@link org.eclipse.rdf4j.model.vocabulary.CONFIG}.
294+
* <p>
295+
* Override this method to provide custom migration logic.
296+
*
297+
* @param config
298+
*/
299+
protected void migrateToNewConfigVocabulary(RepositoryConfig config) {
300+
logger.warn("Configuration for {} uses legacy vocabulary, converting.", config.getID());
301+
addRepositoryConfig(config);
302+
}
303+
291304
@Override
292305
public RepositoryInfo getRepositoryInfo(String id) {
293306
RepositoryConfig config = getRepositoryConfig(id);

0 commit comments

Comments
 (0)