[ 
https://issues.apache.org/jira/browse/CLEREZZA-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hasan Hasan closed CLEREZZA-276.
--------------------------------
    Resolution: Won't Fix

> 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 Hasan
>            Priority: Major
>
> 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 was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to