Skip to content

Fix README code examples + Extension.kt error messages#78

Closed
thomasbuilds wants to merge 2 commits intoandroid:mainfrom
thomasbuilds:main
Closed

Fix README code examples + Extension.kt error messages#78
thomasbuilds wants to merge 2 commits intoandroid:mainfrom
thomasbuilds:main

Conversation

@thomasbuilds
Copy link
Copy Markdown

  • README.md example code didn't compile: ChallengeMatcher has no String constructor, and ChainedChallengeChecker.of requires a CoroutineScope as the first argument.

  • Extension.kt: PatchLevel.from(ASN1Encodable) used this::class.simpleName inside a companion object, which resolves to "Companion" instead of the offending value's runtime class.

  • Extension.kt: ASN1Encodable.toSet<T>() element type-mismatch error reported the container's class instead of the offending element's class (it::class.simpleName).

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 28, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the README documentation to reflect API changes and fixes incorrect class name references in error messages within Extension.kt. A review comment points out that using check in PatchLevel.from may cause the verification process to crash because it throws an IllegalStateException instead of the expected ExtensionParsingException.

Comment on lines +539 to +541
check(patchLevel is ASN1Integer) {
"Must be an ASN1Integer, was ${patchLevel::class.simpleName}"
}
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

Using check here throws an IllegalStateException, which is inconsistent with other ASN.1 parsing methods in this file that throw ExtensionParsingException. More importantly, ASN1Converter.parse (used to parse patch levels in AuthorizationList.from) only catches ExtensionParsingException. If an IllegalStateException is thrown, it will cause the entire verification process to crash instead of gracefully logging the error and returning null for the malformed tag.

Suggested change
check(patchLevel is ASN1Integer) {
"Must be an ASN1Integer, was ${patchLevel::class.simpleName}"
}
if (patchLevel !is ASN1Integer) {
throw ExtensionParsingException("Must be an ASN1Integer, was ${patchLevel::class.simpleName}")
}

@thomasbuilds
Copy link
Copy Markdown
Author

Don't have a google account - I'll close the PR

@sethmoo
Copy link
Copy Markdown
Member

sethmoo commented May 5, 2026

@suzannajiwani I just gave this a quick glance, but it looks like a good change. Can you please pick it up and merge it?

I also think I like that AI-suggested tweak to the exception as well (unless you or @carmenyh can think of a reason we really want an IllegalArgumentException).

Thanks for the patch, @thomasbuilds. Sorry the CLA got in the way :/

@thomasbuilds
Copy link
Copy Markdown
Author

Hi thanks for reviewing this! if commits can be merged without needing me to create google account etc to sign CLA would be nice for sure.

Otherwise you would open new PR and reference me ?

copybara-service Bot pushed a commit that referenced this pull request May 5, 2026
Patched from #78

PiperOrigin-RevId: 910837221
copybara-service Bot pushed a commit that referenced this pull request May 5, 2026
Patched from #78,
originally authored by @thomasbuilds

PiperOrigin-RevId: 910837221
copybara-service Bot pushed a commit that referenced this pull request May 5, 2026
Patched from #78

Co-authored-by: thomasbuilds
PiperOrigin-RevId: 910837221
@sethmoo
Copy link
Copy Markdown
Member

sethmoo commented May 5, 2026

Hi thanks for reviewing this! if commits can be merged without needing me to create google account etc to sign CLA would be nice for sure.

Unfortunately, this is a requirement I don't know how to work around. Google-owned repositories (AFAIK) all require the CLA.

Otherwise you would open new PR and reference me ?

See #79

We'll try to add you as co-author, but the CLA bot may complain again. In that case, we'll be sure to at least name-drop your github id.

@sethmoo
Copy link
Copy Markdown
Member

sethmoo commented May 5, 2026

Dangit... co-author requires the CLA too :(

image

copybara-service Bot pushed a commit that referenced this pull request May 5, 2026
Patched from #78,
originally authored by @thomasbuilds

PiperOrigin-RevId: 910837221
copybara-service Bot pushed a commit that referenced this pull request May 6, 2026
Patched from #78,
originally authored by @thomasbuilds

PiperOrigin-RevId: 910837221
copybara-service Bot pushed a commit that referenced this pull request May 6, 2026
Patched from #78,
originally authored by @thomasbuilds

PiperOrigin-RevId: 911352815
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