This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for PR 5809


This fixes PR 5809.

An earlier patch removed the Comparator, forgetting that that
Map.Entry is not comparable.

I'm a little surprised nobody caught this before.  If you have a
breakpoint and type "actions", you will get a stack trace.

Tom

2008-03-05  Tom Tromey  <tromey@redhat.com>

	Bug 5809
	* ActionPointCommands.java (Actions.interpret): Use Comparator to
	sort the task set.

diff --git a/frysk-core/frysk/hpd/ActionPointCommands.java b/frysk-core/frysk/hpd/ActionPointCommands.java
index 5fdaaf1..3c6c681 100644
--- a/frysk-core/frysk/hpd/ActionPointCommands.java
+++ b/frysk-core/frysk/hpd/ActionPointCommands.java
@@ -46,6 +46,7 @@ import frysk.rt.SourceBreakpoint;
 import frysk.rt.UpdatingDisplayValue;
 import java.util.List;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -213,7 +214,13 @@ abstract class ActionPointCommands extends ParameterizedCommand {
 		    Map.Entry[] taskEntries
 			= new Map.Entry[taskEntrySet.size()];
 		    taskEntrySet.toArray(taskEntries);
-		    Arrays.sort(taskEntries);
+		    Arrays.sort(taskEntries, new Comparator() {
+			public int compare(Object o1, Object o2) {
+			  Map.Entry me1 = (Map.Entry) o1;
+			  Map.Entry me2 = (Map.Entry) o2;
+			  return ((Task) me1.getKey()).compareTo(me2.getKey());
+			}
+		      });
 		    for (int i = 0; i < taskEntries.length; i++) {
 			int id = ((Task) taskEntries[i].getKey()).getTid();
 			SourceBreakpoint.State state = (SourceBreakpoint.State) taskEntries[i]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]