#668 Incorrect usage of Iterator.next method

open
nobody
general (129)
5
2010-11-21
2010-11-21
Suresh
No

We developed a mining-based approach that recovers specifications for APIs of JavaSDK and uses those specifications to detect defects statically. In our study, we found that at various places, return checks are missing in the core components of Columba. It would be great if you could analyze and fix those issues.

Missing condition on Iterator.hasNext() before invoking Iterator.next() method. If the next() method is invoked, it could result in NoSuchElementException.

Class: ContactContextualProvider.java
Method: search, Line: 45

Class: ContactModel.java
Method: getPreferredEmail Line: 154

Class: MailSearchProvider.java
Method: showAllResults Line: 512

Class: MboxParser.java
Method: parseMbox, Line: 41

Class: MessageBuilderHelper.java
Method:removeDoubleEntries Line: 297

Class: RecentMessagesContextualProvider.java
Method:search Line: 86

Class: ReplyToAllCommand.java
Method: initHeader, Line: 86

Discussion