Skip to content
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

Fix return type of substring method #1504

Merged
merged 3 commits into from
Dec 1, 2022

Conversation

rcoh
Copy link
Contributor

@rcoh rcoh commented Nov 18, 2022

Description of changes: The type signature of the substring endpoint method was incorrect—substring will return None when the resulting input string is shorter than the substring operation requires.

This could lead to invalid rules being accepted by the rules engine.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rcoh rcoh requested a review from a team as a code owner November 18, 2022 17:48
@rcoh rcoh force-pushed the substring-return-type branch from 7fcd3a8 to 6402cde Compare November 28, 2022 19:43
@rcoh rcoh force-pushed the substring-return-type branch from 6402cde to be4661b Compare November 28, 2022 19:44
public class RulesetTestUtil {
public static EndpointRuleSet loadRuleSet(String resourceId) {
InputStream is = RulesetTestUtil.class.getClassLoader().getResourceAsStream(resourceId);
assert is != null;
Copy link
Contributor

Choose a reason for hiding this comment

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

This can use the try-with-resources (try (InputStream is...) {) pattern to not need this assertion and also safely close the stream.

@kstich kstich merged commit 10fd0d1 into smithy-lang:main Dec 1, 2022
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