Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353892 - DwarfInfoReader#fix_Dwarf_InlineHighAddress_Problem calls next without calling hasNext first
Summary: DwarfInfoReader#fix_Dwarf_InlineHighAddress_Problem calls next without callin...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ken Ryall CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-04 10:21 EDT by Daniel Thomas CLA
Modified: 2012-05-22 20:39 EDT (History)
2 users (show)

See Also:


Attachments
use hasNext to ensure that NoSuchElementException cannot occur. (1.76 KB, patch)
2011-08-04 10:22 EDT, Daniel Thomas CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.