debugger exiting function with no reason [message #923188] |
Tue, 25 September 2012 17:29 |
Tomasz Kozera Messages: 1 Registered: September 2012 |
Junior Member |
|
|
Hi. I've got Juno release (updated) and I have a problem that the debugger will exit my function in the middle while debugging. Here's the code:
static ArrayList<SyndEntry> GetChannelEntries(String link){
ArrayList<SyndEntry> entries,timeSortedEntries;
entries = new ArrayList<SyndEntry>();
timeSortedEntries = new ArrayList<SyndEntry>();
try {
URL feedSource = new URL(link);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedSource));
entries = (ArrayList<SyndEntry>)feed.getEntries();
//sort by time
for(int i=0; i<entries.size(); i++) {
next: {
for(int j=0; j<i; j++){
if(entries.get(i).getPublishedDate().compareTo(timeSortedEntries.get(j).getPublishedDate()) < 0) {
timeSortedEntries.add(j, entries.get(i));
break next;
}
}
timeSortedEntries.add(entries.get(i));
}
}
//remove old, viewed entries
for(int i=0; i<timeSortedEntries.size(); i++) {
Date d = timeSortedEntries.get(i).getPublishedDate();
if( IsDateBefore(lastRunTime,d) ) { //*** debugger exits after this line
//if( lastRunTime.compareTo(timeSortedEntries.get(i).getPublishedDate()) > 0 ) {
timeSortedEntries.remove(i);
i--;
}else{
break; //because it's sorted by time
}
}
}catch(Exception e) {
System.out.println("Error fetching RSS data from:\n"+link+"\n");
System.exit(1);
}
return timeSortedEntries;
}
static boolean IsDateBefore(Date a, Date b) {
//return (a.getTime() > b.getTime());
long c = a.getTime();
long d = b.getTime();
return c > d;
}
SyndEntry is from rome-1.0 lib (import com.sun.syndication.feed.synd.SyndEntry;)
So when I debug it step-by-step when doing a step-over on the line indicated with *** the debugger moves to the last line (return timeSortedEntries;) - why on earth doest that happen?
If it were some exception it would get caught in the catch block and I would end up there and actually quit the app.
The 'i' var is at 0, the timeSortedEntries array has 50 items, none of which is null.
The data I use in that line (lastRunTime,d) is valid because I can step into the IsDateBefore function and go through it step-by-step to the end. All the local variables there are valid numbers (watched it) and all is calculated properly and returns true in this case.
This stuff happens always in this spot. I rerun the Eclipse, cleaned & rebuild the project but it still behaves like that...
|
|
|
Powered by
FUDForum. Page generated in 0.29421 seconds