Skip to content

Commit

Permalink
Avoid substring if not suffixed
Browse files Browse the repository at this point in the history
  • Loading branch information
daddykotex committed Nov 25, 2023
1 parent 5a6c837 commit 9be31bc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ private Optional<OperationShape> getOperationForInlinedInputOrOutput(Shape shape
String suffix = getOperationInputOrOutputSuffix(shape, preamble);
String shapeName = shape.getId().getName();

String matchingOperationName = shapeName.substring(0, shapeName.length() - suffix.length());
String matchingOperationName =
shapeName.endsWith(suffix)
? shapeName.substring(0, shapeName.length() - suffix.length())
: shapeName;
ShapeId matchingOperationId = ShapeId.fromParts(shape.getId().getNamespace(), matchingOperationName);

return model.shapes(OperationShape.class)
Expand Down

0 comments on commit 9be31bc

Please sign in to comment.