From de8303365023d07bc5207c4ffba0b38985449cbe Mon Sep 17 00:00:00 2001 From: Antonio Garcia-Dominguez Date: Fri, 20 Dec 2024 10:35:29 +0100 Subject: [PATCH] RDFModel: unify how we process properties --- .../src/org/eclipse/epsilon/emc/rdf/RDFModel.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java b/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java index 0efe7b5..06f3001 100644 --- a/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java +++ b/bundles/org.eclipse.epsilon.emc.rdf/src/org/eclipse/epsilon/emc/rdf/RDFModel.java @@ -140,13 +140,16 @@ public void load(StringProperties properties, IRelativePathResolver resolver) th * EMC drivers (e.g. the EmfModel class). */ this.uris.clear(); - for (String uri : properties.getProperty(PROPERTY_URIS).split(",")) { - this.uris.add(uri.strip()); + String sUris = properties.getProperty(PROPERTY_URIS, "").strip(); + if (!sUris.isEmpty()) { + for (String uri : sUris.split(",")) { + this.uris.add(uri.strip()); + } } this.customPrefixesMap.clear(); String sPrefixes = properties.getProperty(PROPERTY_PREFIXES, "").strip(); - if (sPrefixes.length() > 0) { + if (!sPrefixes.isEmpty()) { for (String sItem : sPrefixes.split(",")) { int idxEquals = sItem.indexOf('='); if (idxEquals <= 0 || idxEquals == sItem.length() - 1) { @@ -160,9 +163,9 @@ public void load(StringProperties properties, IRelativePathResolver resolver) th } this.languagePreference.clear(); - String sLanguagePreference = properties.getProperty(PROPERTY_LANGUAGE_PREFERENCE, ""); - if (!sLanguagePreference.isBlank()) { - for (String tag : properties.getProperty(PROPERTY_LANGUAGE_PREFERENCE).split(",")) { + String sLanguagePreference = properties.getProperty(PROPERTY_LANGUAGE_PREFERENCE, "").strip(); + if (!sLanguagePreference.isEmpty()) { + for (String tag : sLanguagePreference.split(",")) { tag = tag.strip(); if (isValidLanguageTag(tag)) { this.languagePreference.add(tag);