Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-06-29 - Use HexFormat for Byte Array to Hex String Conversion

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH OpenCode could not establish approval sufficiency

  • Problem: the model pool exhausted without a valid current-head review control block, so this changed line cannot be approved from deterministic check state alone.
  • Impact: PR-intent mismatches, missing files, robustness bugs, UX/DX regressions, and CodeGraph-backed flow changes could be missed.
  • Fix: rerun OpenCode after model availability recovers, or add the missing source/test/docs/generated verification evidence needed for a source-backed approval.
  • Verification: rerun the OpenCode Review workflow and confirm it emits APPROVE or source-backed REQUEST_CHANGES for this head SHA.

**Learning:** In Java 21, using `String.format("%02x", b)` inside a loop to convert a byte array to a hex string is inefficient and causes unnecessary object allocations and CPU overhead.
**Action:** Always prefer using `java.util.HexFormat.of().formatHex(bytes)` for converting byte arrays to hex strings in this Java 21 codebase to improve performance.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public RetryDeadLetterResult retryDeadLettered(UUID jobId, String operatorId) {
return RetryDeadLetterResult.ACCEPTED;
}

private String contentHash(MultipartFile file) {
private String contentHash(final MultipartFile file) {
try (InputStream stream = file.getInputStream()) {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] buffer = new byte[8192];
Expand All @@ -121,12 +121,7 @@ private String contentHash(MultipartFile file) {
}

byte[] raw = digest.digest();
StringBuilder hex = new StringBuilder(raw.length * 2);
for (byte b : raw) {
hex.append(String.format("%02x", b));
}

return hex.toString();
return java.util.HexFormat.of().formatHex(raw);
} catch (NoSuchAlgorithmException ex) {
throw new IllegalStateException("SHA-256 digest unavailable", ex);
} catch (IOException ex) {
Expand Down
Loading