dgarijo / Widoco

Wizard for documenting ontologies. WIDOCO is a step by step generator of HTML templates with the documentation of your ontology. It uses the LODE environment to create part of the template.
Apache License 2.0
275 stars 85 forks source link

Missing hasNext() Check Before Using next() in Iterator #681

Closed Xiqinger closed 3 months ago

Xiqinger commented 3 months ago

Describe the bug The current implementation utilizes an Iterator without checking the hasNext() method before calling next(). This can lead to NoSuchElementException if there are no more elements in the Iterator. The "printEvaluation" method in the "oops.OOPSevaluation" class utilizes the "elementos.hasNext" check to ensure that "first" has a value. However, it does not guarantee that "second" will have a hasNext() value of true.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image image

Additional context To mitigate this issue, it is recommended to add a hasNext() check before accessing the "second" element, line 350 and line 327 .

dgarijo commented 3 months ago

Thanks!!