Skip to content

fix: handle unencoded spaces in catalog paths and prevent NPE on miss… - #163

Open
alaurie wants to merge 3 commits into
jbangdev:mainfrom
alaurie:fix/appstore-update-v2
Open

fix: handle unencoded spaces in catalog paths and prevent NPE on miss…#163
alaurie wants to merge 3 commits into
jbangdev:mainfrom
alaurie:fix/appstore-update-v2

Conversation

@alaurie

@alaurie alaurie commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR fixes a workflow failure (URISyntaxException) caused by repositories containing unencoded spaces in their file paths (e.g., .../Apache Camel/...), and addresses several edge cases around GitHub content fetching and JSON deserialization.

Changes Made

  • Safe Download Handling: Replaced the direct GHContent.read() invocation with a two-tier approach:
    1. Sanitizes spaces (%20) in getDownloadUrl() and opens the stream directly via URI.create().
    2. Falls back to ghContent.getOwner().getFileContent(...) if direct streaming fails.
  • URI Error Handling: Added IllegalArgumentException to the main loop's catch block to prevent unhandled URI parser exceptions from crashing the catalog aggregation run.
  • NPE Prevention in Deserialization: Added explicit null checks for aliases and templates entries after Gson deserialization, preventing crashes on catalog files that omit either block.
  • GitHub Search Syntax: Fixed search extension filter from .extension(".json") to .extension("json").
  • Search Resiliency: Wrapped PagedSearchIterable paging in fetchCatalogsWithRetry() to catch generic exceptions alongside GHException.

Verification

  • Script now successfully iterates through search results containing paths with spaces without crashing.
  • Empty or partial catalog files parse cleanly without throwing NullPointerException.

…ing keys

- Sanitize URLs and fallback to raw download stream to avoid URISyntaxException on repository paths containing spaces
- Add null checks for aliases and templates during catalog deserialization
- Catch IllegalArgumentException in processing loop to safely skip malformed catalog paths
- Fix search query extension filter syntax
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 69556899-d774-454a-bc72-f321ac86094c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@alaurie

alaurie commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Just realised I ran the Palantir formatter on it when I saved in Intellij so its moved a bunch of stuff around. That ok, or want to do it with how it was? @maxandersen

@alaurie
alaurie marked this pull request as draft August 28, 2026 07:25
@alaurie
alaurie marked this pull request as ready for review August 28, 2026 07:33
@alaurie
alaurie marked this pull request as draft August 28, 2026 07:47
@alaurie

alaurie commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Ran a local test and completed. Found 292 repo's.

@alaurie
alaurie marked this pull request as ready for review August 28, 2026 07:54
@alaurie

alaurie commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #164

@maxandersen

Copy link
Copy Markdown
Contributor

@alurie let's please keep the formatting out of it :)

@alaurie

alaurie commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@maxandersen fixed the formatting issue up now. Tested locally again and still works.

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.

2 participants