Skip to content

Commit

Permalink
proposed fix for issue #15
Browse files Browse the repository at this point in the history
Reuse the natural alphanumeric sort algorithm to sort returned graph
  • Loading branch information
panthony authored and fbacchella committed Apr 23, 2015
1 parent 2854e07 commit c9b2eb0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jrds/webapp/JSonGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import jrds.Probe;
import jrds.Renderer;

import jrds.Util;
import org.apache.log4j.Logger;
import org.json.JSONException;

Expand All @@ -36,9 +37,9 @@ public boolean generate(JrdsJSONWriter w, HostsList root,
if(params.isSorted() && graphs.size() > 1) {
Collections.sort(graphs, new Comparator<GraphNode>() {
public int compare(GraphNode g1, GraphNode g2) {
int order = String.CASE_INSENSITIVE_ORDER.compare(g1.getName(), g2.getName());
int order = Util.nodeComparator.compare(g1.getName(), g2.getName());
if(order == 0)
order = String.CASE_INSENSITIVE_ORDER.compare(g1.getProbe().getHost().getName(), g2.getProbe().getHost().getName());
order = Util.nodeComparator.compare(g1.getProbe().getHost().getName(), g2.getProbe().getHost().getName());
return order;
}
});
Expand Down

0 comments on commit c9b2eb0

Please sign in to comment.