adding a language to an empty list throws an exception
------------------------------------------------------
Key: CLEREZZA-276
URL: https://issues.apache.org/jira/browse/CLEREZZA-276
Project: Clerezza
Issue Type: Bug
Reporter: Hasan
if the platform language list is empty, for example through removing existing
ones, then an exception will be thrown (java.util.NoSuchElementException) when
trying to add a language
this.code in bundle activation throws the abovementioned error
final RdfList rdfList = new RdfList(this.getLanguageListNode(),
systemGraph);
rdfList.remove(new UriRef(this.lingvoj + "en")); // now list is empty
this.languageService.addLanguage(new UriRef(this.lingvoj + "de"));
where getLanguageListNode is:
private NonLiteral getLanguageListNode() {
Iterator<Triple> instances = systemGraph.filter(null, RDF.type,
PLATFORM.Instance);
if (!instances.hasNext()) {
throw new RuntimeException("No Platform:Instance in system graph.");
}
NonLiteral instance = instances.next().getSubject();
Iterator<Triple> langListIter = systemGraph.filter(instance,
PLATFORM.languages, null);
if (langListIter.hasNext()) {
return (NonLiteral) langListIter.next().getObject();
}
BNode listNode = new BNode();
systemGraph.add(new TripleImpl(instance, PLATFORM.languages,
listNode));
return listNode;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.