gnodet opened a new pull request, #1968:
URL: https://github.com/apache/maven-mvnd/pull/1968

   ## Summary
   
   Fix a spurious `EOFException` logged when mvnd reads an old-format 
`registry.bin` file (written by a version before the MAGIC header was 
introduced in #5b7a02f).
   
   ## Root Cause
   
   Commit 5b7a02f added a `MAGIC + FORMAT_VERSION` header to the registry file 
format.
   The read path now unconditionally calls `readInt()` twice — once for 
`magic`, once for `version` — whenever the file is non-empty.
   
   However, an old `registry.bin` written by a previous mvnd with **zero active 
daemons** contains exactly **4 bytes** (the `nb_daemons = 0` count as a single 
int).
   After reading `magic` (value `0x00000000`), the stream is exhausted, and the 
second `readInt()` for `version` throws `EOFException`:
   
   ```
   [WARNING] Invalid daemon registry info at [.../registry.bin], trying to 
recover.
   java.io.EOFException
   ```
   
   ## Fix
   
   Split the validation into two steps: check `magic` first; if it does not 
match `MAGIC`, throw immediately **without** attempting to read `version` — the 
stream may already be empty.
   This preserves the same recovery behaviour (WARNING + self-heal) but logs a 
clean, meaningful message instead of `EOFException`.
   
   ## Tests
   
   Added a regression test case in 
`testRegistryWithoutOrWithOtherHeaderIsReset` covering the 4-byte old-format 
file (empty old registry with `nb_daemons = 0`) to ensure it recovers cleanly.
   
   ---
   _Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to