Skip to content

Change Binary Download Distribution #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

amaanbs
Copy link
Collaborator

@amaanbs amaanbs commented Jun 5, 2025

No description provided.

@amaanbs amaanbs requested a review from a team as a code owner June 5, 2025 23:57
@07souravkunda 07souravkunda requested a review from Copilot June 10, 2025 13:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the hardcoded binary download URL with a dynamic endpoint fetched from an API, adds an authentication key, and implements a retry/fallback mechanism on download failures.

  • Added key to LocalBinary constructor and propagated it in Local.java
  • Introduced fetchSourceUrl() to retrieve download endpoints and wired it into downloadBinary()
  • Wrapped download logic in downloadAndVerifyBinary() with fallback and retry handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/main/java/com/browserstack/local/LocalBinary.java Added key field; implemented downloadAndVerifyBinary(), fetchSourceUrl(), and updated download logic to use dynamic sourceUrl
src/main/java/com/browserstack/local/Local.java Updated LocalBinary instantiation to pass the key from options
Comments suppressed due to low confidence (4)

src/main/java/com/browserstack/local/LocalBinary.java:53

  • String comparison with != checks reference equality, not content. Use !path.isEmpty() or !"".equals(path) to test for an empty string.
if (path != "") {

src/main/java/com/browserstack/local/LocalBinary.java:31

  • Use the primitive boolean instead of the wrapper Boolean for fallbackEnabled to avoid unnecessary boxing and potential null values.
private Boolean fallbackEnabled = false;

src/main/java/com/browserstack/local/Local.java:58

  • The constructor now requires a key. Validate that options.get("key") is present and non-null, and provide a clear error if it's missing.
lb = new LocalBinary(options.get("binarypath"), options.get("key"));

src/main/java/com/browserstack/local/LocalBinary.java:196

  • The new fetchSourceUrl retry and fallback logic is complex and isn’t covered by existing tests. Add unit tests to verify both success and failure paths.
private void fetchSourceUrl() throws LocalException {

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