Skip to content

Code review#490

Merged
mernst merged 1 commit into
plume-lib:masterfrom
mernst:code-review
Jul 6, 2026
Merged

Code review#490
mernst merged 1 commit into
plume-lib:masterfrom
mernst:code-review

Conversation

@mernst

@mernst mernst commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request makes three unrelated cleanup changes: it updates the "iCalendar format" documentation link in README.md to use https, removes a duplicated JVM option from the java invocation in the ical-available elisp script, and renames several identifiers in ICalAvailable.java (remaining_args to remainingArgs, URL loop variable to iCalUrl, date-format loop variable to dateFormat), while also adding a debug branch that streams calendar content bytes to standard output when a specific ParserException occurs.

Changes

File Summary
README.md Changed iCalendar Wikipedia link from http to https
src/main/elisp/ical-available.el Removed duplicate -Dical4j.parsing.relaxed=true JVM argument
src/main/java/org/plumelib/icalavailable/ICalAvailable.java Renamed remaining_argsremainingArgs, URLiCalUrl, this_dfdateFormat; added contentStream debug output for ParserException handling; updated error messages accordingly

Sequence Diagram(s)

sequenceDiagram
  participant CalendarLoadingLoop
  participant ParserExceptionHandler
  participant contentStream
  participant StandardOutput

  CalendarLoadingLoop->>ParserExceptionHandler: handle ParserException
  ParserExceptionHandler->>contentStream: open try-with-resources stream
  ParserExceptionHandler->>StandardOutput: print URL and "Contents:"
  contentStream->>StandardOutput: copy response bytes in 1024-byte chunks
  CalendarLoadingLoop->>StandardOutput: print failure message with iCalUrl
Loading

Estimated code review effort: Low

Related issues: None found in provided context.

Related PRs: None found in provided context.

Suggested labels: cleanup, documentation, refactor

Suggested reviewers: None found in provided context.

🐰 A tweak here, a rename there,
a duplicate dash removed with care,
https now guards our link so bright,
and streams of bytes flow into light.

<visible_sequence_diagrams>

Sequence Diagram(s)

sequenceDiagram
  participant ComponentA
  participant ComponentB
  ComponentA->>ComponentB: observable interaction
Loading

</visible_sequence_diagrams>

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/plumelib/icalavailable/ICalAvailable.java (1)

235-247: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Debug output not gated by --debug option, and refetches the URL.

Two concerns with this new block:

  1. It always executes when the specific ParserException message matches, regardless of the debug flag. Every other diagnostic block in this file (e.g. lines 386-388, 496-498, 533-539, 542-544, 551-553, 556-558) is gated with if (debug) { ... }. Here, unconditionally dumping the entire remote resource to stdout on this error path is inconsistent with that convention and will pollute output for all users hitting this parse error, not just those who opted into --debug.
  2. url.openStream() is called a second time to fetch content for printing, after the first stream (urlStream) already read (and failed to parse) the body. If the resource is dynamic, the printed content may not match what actually caused the ParserException, making the debug output misleading. Consider buffering the bytes from the original urlStream before parsing so the same content used for the failed parse is available for debug printing, avoiding the extra network round trip.
💡 Proposed fix to gate output and avoid the second fetch
-            if ("Error at line 1: Expected [BEGIN], read [<HTML>]".equals(pe.getMessage())) {
-              System.out.println();
-              System.out.println("It is possible that the calendar has moved.");
-              // Debugging: write the URL contents to standard output
-              try (InputStream contentStream = url.openStream()) {
-                System.out.printf("URL: %s%n", url);
-                System.out.println("Contents:");
-                byte[] buffer = new byte[1024];
-                int len = contentStream.read(buffer);
-                while (len != -1) {
-                  System.out.write(buffer, 0, len);
-                  len = contentStream.read(buffer);
-                }
-                System.out.println();
-              }
-            }
+            if ("Error at line 1: Expected [BEGIN], read [<HTML>]".equals(pe.getMessage())) {
+              System.out.println();
+              System.out.println("It is possible that the calendar has moved.");
+              if (debug) {
+                // Debugging: write the URL contents to standard output
+                try (InputStream contentStream = url.openStream()) {
+                  System.out.printf("URL: %s%n", url);
+                  System.out.println("Contents:");
+                  byte[] buffer = new byte[1024];
+                  int len = contentStream.read(buffer);
+                  while (len != -1) {
+                    System.out.write(buffer, 0, len);
+                    len = contentStream.read(buffer);
+                  }
+                  System.out.println();
+                }
+              }
+            }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/org/plumelib/icalavailable/ICalAvailable.java` around lines 235
- 247, The new diagnostic block in ICalAvailable should only run when the
existing debug flag is enabled, consistent with the other debug-only logging
paths in this class. Move the URL/content dump behind the same `if (debug)`
guard used elsewhere, and avoid calling `url.openStream()` a second time;
instead, preserve the bytes already read from `urlStream` for parsing so the
same content can be printed for debugging without a second fetch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/main/java/org/plumelib/icalavailable/ICalAvailable.java`:
- Around line 235-247: The new diagnostic block in ICalAvailable should only run
when the existing debug flag is enabled, consistent with the other debug-only
logging paths in this class. Move the URL/content dump behind the same `if
(debug)` guard used elsewhere, and avoid calling `url.openStream()` a second
time; instead, preserve the bytes already read from `urlStream` for parsing so
the same content can be printed for debugging without a second fetch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8f2b9d38-f978-450a-a0bd-9897914594e6

📥 Commits

Reviewing files that changed from the base of the PR and between 8838535 and 4ed576c.

📒 Files selected for processing (3)
  • README.md
  • src/main/elisp/ical-available.el
  • src/main/java/org/plumelib/icalavailable/ICalAvailable.java
💤 Files with no reviewable changes (1)
  • src/main/elisp/ical-available.el

@mernst
mernst merged commit 5195aae into plume-lib:master Jul 6, 2026
6 checks passed
@mernst
mernst deleted the code-review branch July 6, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant