Skip to content

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

Closed
alaurie wants to merge 1 commit into
jbangdev:mainfrom
alaurie:fix/appstore-update-v2
Closed

alaurie wants to merge 1 commit 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.

@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: Advanced

Run ID: 5d1616c2-02b0-4854-bc45-a650f1397905

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.

@alaurie
alaurie force-pushed the fix/appstore-update-v2 branch from d999cba to c46ceb7 Compare September 14, 2026 22:44
@maxandersen

Copy link
Copy Markdown
Contributor

sorry for delay - got example of catalog failing?

also please add unit test for it.

@alaurie

alaurie commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Looks like main is already fixed. I'll close this PR.

@alaurie alaurie closed this Sep 28, 2026
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