Skip to content

Commit

Permalink
fix: default to classic shadow name in requests (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo authored Oct 2, 2023
1 parent d974c0c commit e97c818
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public DeleteThingShadowResponse handleRequest(DeleteThingShadowRequest request,
logger.atTrace("ipc-delete-thing-shadow-request").log();

ShadowRequest shadowRequest = new ShadowRequest(thingName, shadowName);
shadowName = shadowRequest.getShadowName();
try {
Validator.validateShadowRequest(shadowRequest);
} catch (InvalidRequestParametersException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ public GetThingShadowResponse handleRequest(GetThingShadowRequest request, Strin
return translateExceptions(() -> {
String thingName = request.getThingName();
String shadowName = request.getShadowName();
ShadowRequest shadowRequest = new ShadowRequest(thingName, shadowName);
shadowName = shadowRequest.getShadowName();

try {
logger.atTrace("ipc-get-thing-shadow-request")
.kv(LOG_THING_NAME_KEY, thingName)
.kv(LOG_SHADOW_NAME_KEY, shadowName)
.log();

ShadowRequest shadowRequest = new ShadowRequest(thingName, shadowName);
Validator.validateShadowRequest(shadowRequest);
authorizationHandlerWrapper.doAuthorization(GET_THING_SHADOW, serviceName, shadowRequest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public UpdateThingShadowHandlerResponse handleRequest(UpdateThingShadowRequest r
return translateExceptions(() -> {
String thingName = request.getThingName();
String shadowName = request.getShadowName();
ShadowRequest shadowRequest = new ShadowRequest(thingName, shadowName);
shadowName = shadowRequest.getShadowName();
byte[] updatedDocumentRequestBytes = request.getPayload();
ShadowDocument currentDocument = null;
Optional<String> clientToken = Optional.empty();
Expand All @@ -103,7 +105,6 @@ public UpdateThingShadowHandlerResponse handleRequest(UpdateThingShadowRequest r
.kv(LOG_SHADOW_NAME_KEY, shadowName)
.log();

ShadowRequest shadowRequest = new ShadowRequest(thingName, shadowName);
try {
Validator.validateShadowRequest(shadowRequest);
} catch (InvalidRequestParametersException e) {
Expand Down

0 comments on commit e97c818

Please sign in to comment.