feat(crash): ModResolutionException (Could not resolve valid mod collection)
This commit is contained in:
@@ -51,18 +51,34 @@ public class CrashReportAnalyzerTest {
|
||||
CrashReportAnalyzer.Rule.JDK_9);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jvm32() throws IOException {
|
||||
CrashReportAnalyzer.Result result = findResultByRule(
|
||||
CrashReportAnalyzer.anaylze(loadLog("/logs/jvm_32bit.txt")),
|
||||
CrashReportAnalyzer.Rule.JVM_32BIT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void modResolution() throws IOException {
|
||||
CrashReportAnalyzer.Result result = findResultByRule(
|
||||
CrashReportAnalyzer.anaylze(loadLog("/logs/mod_resolution.txt")),
|
||||
CrashReportAnalyzer.Rule.MOD_RESOLUTION);
|
||||
Assert.assertEquals(("Errors were found!\n" +
|
||||
" - Mod test depends on mod {fabricloader @ [>=0.11.3]}, which is missing!\n" +
|
||||
" - Mod test depends on mod {fabric @ [*]}, which is missing!\n" +
|
||||
" - Mod test depends on mod {java @ [>=16]}, which is missing!\n").replaceAll("\\s+", ""),
|
||||
" - Mod test depends on mod {fabricloader @ [>=0.11.3]}, which is missing!\n" +
|
||||
" - Mod test depends on mod {fabric @ [*]}, which is missing!\n" +
|
||||
" - Mod test depends on mod {java @ [>=16]}, which is missing!\n").replaceAll("\\s+", ""),
|
||||
result.getMatcher().group("reason").replaceAll("\\s+", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void modResolutionCollection() throws IOException {
|
||||
CrashReportAnalyzer.Result result = findResultByRule(
|
||||
CrashReportAnalyzer.anaylze(loadLog("/logs/mod_resolution_collection.txt")),
|
||||
CrashReportAnalyzer.Rule.MOD_RESOLUTION_COLLECTION);
|
||||
Assert.assertEquals("tabtps-fabric", result.getMatcher().group("sourcemod"));
|
||||
Assert.assertEquals("{fabricloader @ [>=0.11.1]", result.getMatcher().group("destmod"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tooOldJava() throws IOException {
|
||||
CrashReportAnalyzer.Result result = findResultByRule(
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.game;
|
||||
|
||||
import org.jackhuang.hmcl.util.Pair;
|
||||
import org.jackhuang.hmcl.util.Range;
|
||||
import org.jackhuang.hmcl.util.versioning.VersionNumber;
|
||||
import org.junit.Assert;
|
||||
@@ -27,13 +26,13 @@ public class JavaVersionConstraintTest {
|
||||
|
||||
@Test
|
||||
public void vanillaJava16() {
|
||||
Pair<Range<VersionNumber>, Range<VersionNumber>> range = JavaVersionConstraint.findSuitableJavaVersionRange(
|
||||
JavaVersionConstraint.VersionRange range = JavaVersionConstraint.findSuitableJavaVersionRange(
|
||||
VersionNumber.asVersion("1.17"),
|
||||
null
|
||||
);
|
||||
|
||||
Assert.assertEquals(
|
||||
Range.between(VersionNumber.asVersion("16"), VersionNumber.asVersion(JavaVersionConstraint.MAX)),
|
||||
range.getKey());
|
||||
range.getMandatory());
|
||||
}
|
||||
}
|
||||
|
||||
4
HMCLCore/src/test/resources/logs/jvm_32bit.txt
Normal file
4
HMCLCore/src/test/resources/logs/jvm_32bit.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Invalid initial heap size: -Xms4096M
|
||||
The specified size exceeds the maximum representable size.
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
@@ -0,0 +1,17 @@
|
||||
[00:39:00] [main/INFO]: Loading for game Minecraft 1.17.1
|
||||
Exception in thread "main" java.lang.RuntimeException: Failed to resolve mods!
|
||||
at net.fabricmc.loader.FabricLoader.load(FabricLoader.java:159)
|
||||
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:122)
|
||||
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)
|
||||
Caused by: net.fabricmc.loader.discovery.ModResolutionException: Could not resolve valid mod collection (at: tabtps-fabric requires {fabricloader @ [>=0.11.1]})
|
||||
at net.fabricmc.loader.discovery.ModResolver.findCompatibleSet(ModResolver.java:184)
|
||||
at net.fabricmc.loader.discovery.ModResolver.resolve(ModResolver.java:508)
|
||||
at net.fabricmc.loader.FabricLoader.load(FabricLoader.java:157)
|
||||
... 2 more
|
||||
Caused by: net.fabricmc.loader.util.sat4j.specs.ContradictionException: Creating Empty clause ?
|
||||
at net.fabricmc.loader.util.sat4j.minisat.constraints.cnf.Clauses.propagationCheck(Clauses.java:117)
|
||||
at net.fabricmc.loader.util.sat4j.minisat.constraints.cnf.Clauses.sanityCheck(Clauses.java:97)
|
||||
at net.fabricmc.loader.util.sat4j.minisat.constraints.MixedDataStructureDanielWL.createClause(MixedDataStructureDanielWL.java:81)
|
||||
at net.fabricmc.loader.util.sat4j.minisat.core.Solver.addClause(Solver.java:401)
|
||||
at net.fabricmc.loader.discovery.ModResolver.findCompatibleSet(ModResolver.java:182)
|
||||
... 4 more
|
||||
Reference in New Issue
Block a user