Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353892

Summary: DwarfInfoReader#fix_Dwarf_InlineHighAddress_Problem calls next without calling hasNext first
Product: [Tools] CDT Reporter: Daniel Thomas <daniel.thomas>
Component: cdt-debug-edcAssignee: Ken Ryall <ken.ryall>
Status: RESOLVED FIXED QA Contact: Ken Ryall <ken.ryall>
Severity: normal    
Priority: P3 CC: cdtdoug, kirk.beitz
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
use hasNext to ensure that NoSuchElementException cannot occur. cdtdoug: iplog+

Description Daniel Thomas CLA 2011-08-04 10:21:10 EDT
Build Identifier: 

In this method DwarfInfoReader calls .next() on a Iterator called lineEntries, this can result in NoSuchElementExceptions occurring. The paradigm used in the code is the check if return value is null paradigm which is incorrect for iterators.

The patch fixes this by using hasNext() to perform the same logical operation correctly.

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-04 10:22:02 EDT
Created attachment 200918 [details]
use hasNext to ensure that NoSuchElementException cannot occur.
Comment 2 Kirk Beitz CLA 2011-08-06 06:55:06 EDT
code very similar to this is in the process of being merged to the eclipse edc git repository after having encountered this bug in our local source repository.