Class BugReportBundle
The file list is a deliberate manifest rather than a directory scan. MegaMek's log directory also accumulates
one gamelog*.html combat report per game and a Bot_*.mul unit list per bot per game, so a working
installation can hold hundreds of megabytes there. Sweeping the directory wholesale would produce an archive far
too large to attach, while a naive *.log filter would miss the combat report, which is usually the single
most useful artifact in a MegaMek bug report.
The archive is capped at MAX_ARCHIVE_BYTES. Candidates are added in priority order and any that would
push the total past the cap are skipped and named in the returned BugReportBundle.BundleResult, so the caller can tell the
player exactly what was left out instead of silently truncating.
This class deliberately has no Swing or game-state dependencies so that it can be exercised headlessly.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe outcome of writing a bug report archive. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longGitHub refuses issue attachments larger than 25 MB, whatever the file type.static final StringThe archive entry holding the version, OS and Java details. -
Constructor Summary
ConstructorsConstructorDescriptionBugReportBundle(File logDirectory, File saveGameFile, String systemInformation, String gameLogFileName) Creates a bundle description. -
Method Summary
Modifier and TypeMethodDescriptionWrites the archive, adding candidates in priority order until the size cap is reached.
-
Field Details
-
MAX_ARCHIVE_BYTES
public static final long MAX_ARCHIVE_BYTESGitHub refuses issue attachments larger than 25 MB, whatever the file type.- See Also:
-
SYSTEM_INFO_ENTRY_NAME
The archive entry holding the version, OS and Java details.- See Also:
-
-
Constructor Details
-
BugReportBundle
public BugReportBundle(File logDirectory, @Nullable File saveGameFile, String systemInformation, @Nullable String gameLogFileName) Creates a bundle description. Nothing is read from disk untilwriteTo(File)is called.- Parameters:
logDirectory- the directory holding MegaMek's logs; read fromClientPreferences.getLogDirectory()rather than assumed, because players can relocate it. A directory that does not exist is tolerated and yields a logs-free archive.saveGameFile- the saved game to place at the archive root, ornullwhen no game was running (the main-menu and startup-crash cases)systemInformation- the version, OS and Java details to write to "system-info.txt"gameLogFileName- the configured combat-report filename, normallygamelog.html, used to find the newest matching report; ornullto collect no combat report
-
-
Method Details
-
writeTo
Writes the archive, adding candidates in priority order until the size cap is reached.Reaching the cap is not an error: remaining candidates are recorded as skipped and the archive is still completed, because a partial bundle is far more useful to a maintainer than none.
- Parameters:
archiveFile- the zip file to create, overwriting any existing file at that path- Returns:
- a description of what was written
- Throws:
IOException- if the archive itself cannot be created or written
-