mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +00:00
Named malformed history manifests
- Truncated or malformed generation manifests and epoch metadata report as invalid history again after the strict reader change - The datapack metadata test expects the range and supported_formats to start at the 1.21.1 format
This commit is contained in:
1 parent
478fd4d350
commit
64e4c82716
2 files changed
+10
-3
No files matched your search
@@ -10,7 +10,9 @@ import com.google.gson.JsonParseException;
|
|||||||
import art.arcane.volmlib.util.json.StrictJsonReader;
|
import art.arcane.volmlib.util.json.StrictJsonReader;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.google.gson.stream.JsonToken;
|
import com.google.gson.stream.JsonToken;
|
||||||
|
import com.google.gson.stream.MalformedJsonException;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
@@ -247,7 +249,8 @@ public final class GenerationHistoryStore {
|
|||||||
epochs.add(readEpoch(manifestPath.getParent(), reference.getAsString()));
|
epochs.add(readEpoch(manifestPath.getParent(), reference.getAsString()));
|
||||||
}
|
}
|
||||||
return GenerationManifest.fromJson(index, epochs);
|
return GenerationManifest.fromJson(index, epochs);
|
||||||
} catch (JsonParseException | IllegalArgumentException | ArithmeticException exception) {
|
} catch (JsonParseException | MalformedJsonException | EOFException | IllegalArgumentException
|
||||||
|
| ArithmeticException exception) {
|
||||||
throw new IOException("Invalid generation manifest: " + manifestPath, exception);
|
throw new IOException("Invalid generation manifest: " + manifestPath, exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +327,7 @@ public final class GenerationHistoryStore {
|
|||||||
throw new IOException("Generation epoch metadata identity differs from its reference: " + metadata);
|
throw new IOException("Generation epoch metadata identity differs from its reference: " + metadata);
|
||||||
}
|
}
|
||||||
return epoch;
|
return epoch;
|
||||||
} catch (JsonParseException | IllegalArgumentException exception) {
|
} catch (JsonParseException | MalformedJsonException | EOFException | IllegalArgumentException exception) {
|
||||||
throw new IOException("Invalid generation epoch metadata: " + metadata, exception);
|
throw new IOException("Invalid generation epoch metadata: " + metadata, exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,11 +169,15 @@ public class IrisDatapackCompilerTest {
|
|||||||
int minFormat = pack.getInt("min_format");
|
int minFormat = pack.getInt("min_format");
|
||||||
int maxFormat = pack.getInt("max_format");
|
int maxFormat = pack.getInt("max_format");
|
||||||
|
|
||||||
assertEquals(101, minFormat);
|
assertEquals(DataVersion.V1_21_1.getPackFormat(), minFormat);
|
||||||
assertEquals(121, maxFormat);
|
assertEquals(121, maxFormat);
|
||||||
assertEquals(maxFormat, pack.getInt("pack_format"));
|
assertEquals(maxFormat, pack.getInt("pack_format"));
|
||||||
|
assertEquals(minFormat, pack.getJSONArray("supported_formats").getInt(0));
|
||||||
|
assertEquals(maxFormat, pack.getJSONArray("supported_formats").getInt(1));
|
||||||
|
|
||||||
// One artifact serves supported runtimes: each supported DataVersion's format must be in range.
|
// One artifact serves supported runtimes: each supported DataVersion's format must be in range.
|
||||||
|
assertTrue(minFormat <= DataVersion.V1_21_1.getPackFormat()
|
||||||
|
&& DataVersion.V1_21_1.getPackFormat() <= maxFormat);
|
||||||
assertTrue(minFormat <= DataVersion.V26_1_2.getPackFormat()
|
assertTrue(minFormat <= DataVersion.V26_1_2.getPackFormat()
|
||||||
&& DataVersion.V26_1_2.getPackFormat() <= maxFormat);
|
&& DataVersion.V26_1_2.getPackFormat() <= maxFormat);
|
||||||
assertTrue(minFormat <= DataVersion.V26_2.getPackFormat()
|
assertTrue(minFormat <= DataVersion.V26_2.getPackFormat()
|
||||||
|
|||||||
Reference in new issue
Block a user