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 24, 2023
1 parent bb6b3cc commit ae10d4b
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 ae10d4b

Please sign in to comment.