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

@ -405,6 +405,10 @@
"name":"java.util.concurrent.atomic.AtomicBoolean", "name":"java.util.concurrent.atomic.AtomicBoolean",
"fields":[{"name":"value"}] "fields":[{"name":"value"}]
}, },
{
"name":"java.util.concurrent.atomic.AtomicMarkableReference",
"fields":[{"name":"pair"}]
},
{ {
"name":"java.util.concurrent.atomic.AtomicReference", "name":"java.util.concurrent.atomic.AtomicReference",
"fields":[{"name":"value"}] "fields":[{"name":"value"}]
@ -951,19 +955,22 @@
"name":"org.asamk.signal.jsonrpc.JsonRpcRequest", "name":"org.asamk.signal.jsonrpc.JsonRpcRequest",
"allDeclaredFields":true, "allDeclaredFields":true,
"allDeclaredMethods":true, "allDeclaredMethods":true,
"allDeclaredConstructors":true "allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
}, },
{ {
"name":"org.asamk.signal.jsonrpc.JsonRpcResponse", "name":"org.asamk.signal.jsonrpc.JsonRpcResponse",
"allDeclaredFields":true, "allDeclaredFields":true,
"allDeclaredMethods":true, "allDeclaredMethods":true,
"allDeclaredConstructors":true "allDeclaredConstructors":true,
"methods":[{"name":"getError","parameterTypes":[] }, {"name":"getId","parameterTypes":[] }, {"name":"getJsonrpc","parameterTypes":[] }, {"name":"getResult","parameterTypes":[] }]
}, },
{ {
"name":"org.asamk.signal.jsonrpc.JsonRpcResponse$Error", "name":"org.asamk.signal.jsonrpc.JsonRpcResponse$Error",
"allDeclaredFields":true, "allDeclaredFields":true,
"allDeclaredMethods":true, "allDeclaredMethods":true,
"allDeclaredConstructors":true "allDeclaredConstructors":true,
"methods":[{"name":"getCode","parameterTypes":[] }, {"name":"getData","parameterTypes":[] }, {"name":"getMessage","parameterTypes":[] }]
}, },
{ {
"name":"org.asamk.signal.manager.api.PhoneNumberSharingMode", "name":"org.asamk.signal.manager.api.PhoneNumberSharingMode",
@ -2797,7 +2804,7 @@
}, },
{ {
"name":"sun.security.provider.SecureRandom", "name":"sun.security.provider.SecureRandom",
"methods":[{"name":"<init>","parameterTypes":[] }] "methods":[{"name":"<init>","parameterTypes":[] }, {"name":"<init>","parameterTypes":["java.security.SecureRandomParameters"] }]
}, },
{ {
"name":"sun.security.provider.certpath.PKIXCertPathValidator", "name":"sun.security.provider.certpath.PKIXCertPathValidator",

View file

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