lingochamp/FileDownloader · error · NoFieldException
getFileName
Error message
getFileName
What it means
This is not a system error but a sentinel guard: the MessageSnapshot subclass backing this object simply does not carry a filename field, so any call to getFileName() throws NoFieldException. It fires when code asks a sparse snapshot (e.g. a pending/connected/progress snapshot created without file metadata) for a field it never stored; the fault lies with the caller accessing an absent field, not with the snapshot data itself.
Solutions
- Check the snapshot type/status before calling getFileName(); only completed or file-aware snapshots carry the name
- Obtain the filename from the FileDownloadTask/DownloadStatusTask or the download database rather than from a snapshot that may lack it
- Catch NoFieldException when iterating heterogeneous snapshots and skip or default the field
- When creating snapshots that consumers will query for filenames, use a snapshot variant that includes the filename field
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshot.java:88 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08).
Data as JSON: /api/errors/fe4f6f65940a2728.
Report an issue: GitHub.
Appendix: source
Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshot.java:88
@Override
public int getSmallSofarBytes() {
throw new NoFieldException("getSmallSofarBytes", this);
}
@Override
public int getSmallTotalBytes() {
throw new NoFieldException("getSmallTotalBytes", this);
}
@Override
public boolean isReusedDownloadedFile() {
throw new NoFieldException("isReusedDownloadedFile", this);
}
@Override
public String getFileName() {
throw new NoFieldException("getFileName", this);
}
@Override
public boolean isLargeFile() {
return isLargeFile;
}
public interface IWarnMessageSnapshot {
MessageSnapshot turnToPending();
}
@Override
public int describeContents() {
return 0;
}
View on GitHub (pinned to 6237a8cac1)