Fix README code examples + Extension.kt error messages#78
Fix README code examples + Extension.kt error messages#78thomasbuilds wants to merge 2 commits intoandroid:mainfrom
Conversation
|
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. |
There was a problem hiding this comment.
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.
| check(patchLevel is ASN1Integer) { | ||
| "Must be an ASN1Integer, was ${patchLevel::class.simpleName}" | ||
| } |
There was a problem hiding this comment.
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.
| 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}") | |
| } |
|
Don't have a google account - I'll close the PR |
|
@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 Thanks for the patch, @thomasbuilds. Sorry the CLA got in the way :/ |
|
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 ? |
Patched from #78 PiperOrigin-RevId: 910837221
Patched from #78, originally authored by @thomasbuilds PiperOrigin-RevId: 910837221
Patched from #78 Co-authored-by: thomasbuilds PiperOrigin-RevId: 910837221
Unfortunately, this is a requirement I don't know how to work around. Google-owned repositories (AFAIK) all require the CLA.
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. |
Patched from #78, originally authored by @thomasbuilds PiperOrigin-RevId: 910837221
Patched from #78, originally authored by @thomasbuilds PiperOrigin-RevId: 910837221
Patched from #78, originally authored by @thomasbuilds PiperOrigin-RevId: 911352815

README.md example code didn't compile:
ChallengeMatcherhas noStringconstructor, andChainedChallengeChecker.ofrequires aCoroutineScopeas the first argument.Extension.kt:
PatchLevel.from(ASN1Encodable)usedthis::class.simpleNameinside acompanion 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).