Try and clean up cycle detection output a bit

This commit is contained in:
Christian 2013-05-27 09:25:50 -04:00
parent aa18bed75e
commit ece6290c19
3 changed files with 24 additions and 3 deletions

View file

@ -157,4 +157,10 @@ public class DummyModContainer implements ModContainer
{ {
return null; return null;
} }
@Override
public String toString()
{
return md != null ? getModId() :"Unknown Dummy Container @" + System.identityHashCode(this);
}
} }

View file

@ -148,4 +148,10 @@ public class InjectedModContainer implements ModContainer
{ {
return wrappedContainer.getSigningCertificate(); return wrappedContainer.getSigningCertificate();
} }
@Override
public String toString()
{
return "Wrapped{"+wrappedContainer.toString()+"}";
}
} }

View file

@ -25,6 +25,10 @@ import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.TreeSet; import java.util.TreeSet;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.FMLLog;
/** /**
* Topological sort for mod loading * Topological sort for mod loading
* *
@ -174,7 +178,12 @@ public class TopologicalSort
return; return;
} }
System.out.printf("%s: %s\n%s\n%s\n", node, sortedResult, visitedNodes, expandedNodes); FMLLog.severe("Mod Sorting failed.");
FMLLog.severe("Visting node %s", node);
FMLLog.severe("Current sorted list : %s", sortedResult);
FMLLog.severe("Visited set for this node : %s", visitedNodes);
FMLLog.severe("Explored node set : %s", expandedNodes);
FMLLog.severe("Likely cycle is in : %s", Sets.difference(expandedNodes, visitedNodes));
throw new ModSortingException("There was a cycle detected in the input graph, sorting is not possible", node, visitedNodes); throw new ModSortingException("There was a cycle detected in the input graph, sorting is not possible", node, visitedNodes);
} }