Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326315 - Error in ProgressStatistics.getRecentSpeed
Summary: Error in ProgressStatistics.getRecentSpeed
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-27 11:04 EDT by John Arthorne CLA
Modified: 2010-10-01 10:40 EDT (History)
0 users

See Also:


Attachments
Log file (7.06 KB, text/plain)
2010-09-27 11:05 EDT, John Arthorne CLA
no flags Details
Fix (1.06 KB, patch)
2010-10-01 10:39 EDT, John Arthorne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2010-09-27 11:04:43 EDT
Build: 4.1 M2

I found the following error in my log when starting this build:

java.util.NoSuchElementException
	at java.util.TreeMap.firstKey(TreeMap.java:4251)
	at java.util.TreeMap$NavigableSubMap.values(TreeMap.java:3042)
	at org.eclipse.equinox.internal.p2.repository.ProgressStatistics.getRecentSpeed(ProgressStatistics.java:101)
	at org.eclipse.equinox.internal.p2.repository.ProgressStatistics.report(ProgressStatistics.java:126)
Comment 1 John Arthorne CLA 2010-09-27 11:05:16 EDT
Created attachment 179654 [details]
Log file
Comment 2 John Arthorne CLA 2010-10-01 10:39:24 EDT
Created attachment 180060 [details]
Fix

This looks to me like a class library bug, but there is an easy enough workaround. Here is a snippet to reduce the failure:

	TreeMap map = new TreeMap();
	SortedMap headMap = map.headMap("String");
	System.out.println(headMap.values());

This produces NoSuchElementException when running on IBM Java 6 SR 3, and I suspect on some Sun Java 6 versions as well. In newer Java 6 releases it doesn't produce a failure. In any case, a simple isEmpty() check will avoid the problem.
Comment 3 John Arthorne CLA 2010-10-01 10:40:09 EDT
Fix released.