Fix json deserialization for request params

Fixes #1261
This commit is contained in:
AsamK 2023-06-17 12:59:55 +02:00
parent a3f7de89f1
commit ac815f7598
5 changed files with 18 additions and 8 deletions

View file

@ -34,6 +34,9 @@ public class FinishLinkCommand implements JsonRpcMultiCommand<FinishLinkCommand.
public void handleCommand(
final FinishLinkParams request, final MultiAccountManager m, final JsonWriter jsonWriter
) throws CommandException {
if (request.deviceLinkUri() == null) {
throw new UserErrorException("Missing deviceLinkUri.");
}
final URI deviceLinkUri;
try {
deviceLinkUri = new URI(request.deviceLinkUri());
@ -71,7 +74,7 @@ public class FinishLinkCommand implements JsonRpcMultiCommand<FinishLinkCommand.
jsonWriter.write(new JsonFinishLink(number));
}
record FinishLinkParams(String deviceLinkUri, String deviceName) {}
public record FinishLinkParams(String deviceLinkUri, String deviceName) {}
private record JsonFinishLink(String number) {}
}

View file

@ -112,5 +112,5 @@ public class ReceiveCommand implements LocalCommand, JsonRpcSingleCommand<Receiv
}
}
record ReceiveParams(Double timeout, Integer maxMessages) {}
public record ReceiveParams(Double timeout, Integer maxMessages) {}
}

View file

@ -97,5 +97,5 @@ public class RegisterCommand implements RegistrationCommand, JsonRpcRegistration
}
}
record RegistrationParams(Boolean voice, String captcha) {}
public record RegistrationParams(Boolean voice, String captcha) {}
}

View file

@ -77,5 +77,5 @@ public class VerifyCommand implements RegistrationCommand, JsonRpcRegistrationCo
}
}
record VerifyParams(String verificationCode, String pin) {}
public record VerifyParams(String verificationCode, String pin) {}
}