fix: resolve 11 P1 bugs from audit (leaderboard, SQL, coop, jump, lifecycle, schematics, config)
- leaderboard: parse M:SS.mmm/H:MM:SS(.mmm), switch TIME sort to long (п.25) - sql: single Hikari pool, non-blocking connect, adaptive init order, settings JSON round-trip (п.27-30) - coop: remove unregister recursion via session-only leave + reentrancy guard (п.24) - jump: perpendicular jitter for diagonal heading, valid safety-fallback on retry exhaustion (п.32-33) - lifecycle: fall threshold relative to course, lead via generated-blocks counter, one-time rewards once (п.35-37) - schematics: catch RuntimeExceptions, validate size, 10MB file limit (п.31) - config merge: preserve block-sequence lists and ignored sections, fix path reversal (п.26) - tests: +31 (score, jump, schematics, config merge) = 72 total
This commit is contained in:
parent
c0ca488b9d
commit
fea15e61c8
27 changed files with 1012 additions and 167 deletions
|
|
@ -12,18 +12,27 @@ import java.io.IOException;
|
|||
|
||||
public final class SchemLoader {
|
||||
|
||||
private static final int MAX_FILE_SIZE = 10 * 1024 * 1024;
|
||||
|
||||
private SchemLoader() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Clipboard load(@NotNull File file) throws IOException {
|
||||
if (file.length() > MAX_FILE_SIZE) {
|
||||
throw new IOException("Schematic file too large: " + file.getName());
|
||||
}
|
||||
final ClipboardFormat format = ClipboardFormats.findByFile(file);
|
||||
if (format == null) {
|
||||
throw new IOException("Unsupported schematic file: " + file.getName());
|
||||
}
|
||||
try (FileInputStream in = new FileInputStream(file);
|
||||
ClipboardReader reader = format.getReader(in)) {
|
||||
return reader.read();
|
||||
final Clipboard clipboard = reader.read();
|
||||
if (clipboard == null) {
|
||||
throw new IOException("Schematic file returned no clipboard: " + file.getName());
|
||||
}
|
||||
return clipboard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue