Skip to content

Commit 910fd64

Browse files
added classcastexception catch to v3identitymap
1 parent 9207916 commit 910fd64

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/com/uid2/operator/model/IdentityMapRequest.java renamed to src/main/java/com/uid2/operator/model/IdentityMapV3Request.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.fasterxml.jackson.annotation.*;
44

5-
public record IdentityMapRequest (
5+
public record IdentityMapV3Request(
66
@JsonSetter(contentNulls = Nulls.FAIL)
77
@JsonProperty("email") IdentityInput[] email,
88

@@ -14,7 +14,7 @@ public record IdentityMapRequest (
1414

1515
@JsonSetter(contentNulls = Nulls.FAIL)
1616
@JsonProperty("phone_hash") IdentityInput[] phone_hash
17-
){
17+
) {
1818
public record IdentityInput(
1919
@JsonSetter(nulls = Nulls.FAIL)
2020
@JsonProperty("i") String input

src/main/java/com/uid2/operator/vertx/UIDOperatorVerticle.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,21 +1727,21 @@ private void handleIdentityMapV3(RoutingContext rc) {
17271727
return;
17281728
}
17291729

1730-
IdentityMapRequest input = OBJECT_MAPPER.readValue(jsonInput.toString(), IdentityMapRequest.class);
1730+
IdentityMapV3Request input = OBJECT_MAPPER.readValue(jsonInput.toString(), IdentityMapV3Request.class);
17311731
final Map<String, InputUtil.InputVal[]> normalizedInput = processIdentityMapMixedInput(rc, input);
17321732

17331733
if (!validateServiceLink(rc)) { return; }
17341734

17351735
final JsonObject response = processIdentityMapV3Response(rc, normalizedInput);
17361736
ResponseUtil.SuccessV2(rc, response);
1737-
} catch (JsonProcessingException processingException) {
1737+
} catch (ClassCastException | JsonProcessingException processingException) {
17381738
ResponseUtil.LogInfoAndSend400Response(rc, "Incorrect request format");
17391739
} catch (Exception e) {
17401740
ResponseUtil.LogErrorAndSendResponse(ResponseStatus.UnknownError, 500, rc, "Unknown error while mapping identity v3", e);
17411741
}
17421742
}
17431743

1744-
private Map<String, InputUtil.InputVal[]> processIdentityMapMixedInput(RoutingContext rc, IdentityMapRequest input) {
1744+
private Map<String, InputUtil.InputVal[]> processIdentityMapMixedInput(RoutingContext rc, IdentityMapV3Request input) {
17451745
final Map<String, InputUtil.InputVal[]> normalizedIdentities = new HashMap<>();
17461746

17471747
var normalizedEmails = parseIdentitiesInput(input.email(), IdentityType.Email, InputUtil.IdentityInputType.Raw, rc);
@@ -2081,7 +2081,7 @@ private InputUtil.InputVal normalizeIdentity(String identity, IdentityType ident
20812081
};
20822082
}
20832083

2084-
private InputUtil.InputVal[] parseIdentitiesInput(IdentityMapRequest.IdentityInput[] identities, IdentityType identityType, InputUtil.IdentityInputType inputType, RoutingContext rc) {
2084+
private InputUtil.InputVal[] parseIdentitiesInput(IdentityMapV3Request.IdentityInput[] identities, IdentityType identityType, InputUtil.IdentityInputType inputType, RoutingContext rc) {
20852085
if (identities == null || identities.length == 0) {
20862086
return new InputUtil.InputVal[0];
20872087
}

0 commit comments

Comments
 (0)