mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: remove all deprecated "new JsonParser()" in favor of static method
parent
c2da80429e
commit
e04354ede9
|
@ -753,8 +753,7 @@ public class OpenviduConfig {
|
|||
}
|
||||
|
||||
private List<Header> checkWebhookHeaders(String headers) throws Exception {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement elem = parser.parse(headers);
|
||||
JsonElement elem = JsonParser.parseString(headers);
|
||||
JsonArray headersJsonArray = elem.getAsJsonArray();
|
||||
List<Header> headerList = new ArrayList<>();
|
||||
|
||||
|
@ -781,8 +780,7 @@ public class OpenviduConfig {
|
|||
}
|
||||
|
||||
private List<CDREventName> checkWebhookEvents(String events) throws Exception {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement elem = parser.parse(events);
|
||||
JsonElement elem = JsonParser.parseString(events);
|
||||
JsonArray eventsJsonArray = elem.getAsJsonArray();
|
||||
List<CDREventName> eventList = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public abstract class SessionManager {
|
|||
|
||||
public void sendMessage(String message, String sessionId) {
|
||||
try {
|
||||
JsonObject messageJson = new JsonParser().parse(message).getAsJsonObject();
|
||||
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
||||
sessionEventsHandler.onSendMessage(null, messageJson, getParticipants(sessionId), null, null);
|
||||
} catch (JsonSyntaxException | IllegalStateException e) {
|
||||
throw new OpenViduException(Code.SIGNAL_FORMAT_INVALID_ERROR_CODE,
|
||||
|
@ -116,7 +116,7 @@ public abstract class SessionManager {
|
|||
|
||||
public void sendMessage(Participant participant, String message, Integer transactionId) {
|
||||
try {
|
||||
JsonObject messageJson = new JsonParser().parse(message).getAsJsonObject();
|
||||
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
||||
sessionEventsHandler.onSendMessage(participant, messageJson, getParticipants(participant.getSessionId()),
|
||||
transactionId, null);
|
||||
} catch (JsonSyntaxException | IllegalStateException e) {
|
||||
|
|
|
@ -338,7 +338,7 @@ public class SessionRestController {
|
|||
|
||||
if (params.get("kurentoOptions") != null) {
|
||||
try {
|
||||
kurentoOptions = new JsonParser().parse(params.get("kurentoOptions").toString()).getAsJsonObject();
|
||||
kurentoOptions = JsonParser.parseString(params.get("kurentoOptions").toString()).getAsJsonObject();
|
||||
} catch (Exception e) {
|
||||
return this.generateErrorResponse("Error in parameter 'kurentoOptions'. It is not a valid JSON object",
|
||||
"/api/tokens", HttpStatus.BAD_REQUEST);
|
||||
|
|
|
@ -477,7 +477,7 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
|||
&& participant.getToken().getKurentoTokenOptions().isFilterAllowed(filterType))) {
|
||||
JsonObject filterOptions;
|
||||
try {
|
||||
filterOptions = new JsonParser().parse(getStringParam(request, ProtocolElements.FILTER_OPTIONS_PARAM))
|
||||
filterOptions = JsonParser.parseString(getStringParam(request, ProtocolElements.FILTER_OPTIONS_PARAM))
|
||||
.getAsJsonObject();
|
||||
} catch (JsonSyntaxException e) {
|
||||
throw new OpenViduException(Code.FILTER_NOT_APPLIED_ERROR_CODE,
|
||||
|
@ -525,7 +525,7 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
|||
}
|
||||
String streamId = getStringParam(request, ProtocolElements.FILTER_STREAMID_PARAM);
|
||||
String filterMethod = getStringParam(request, ProtocolElements.FILTER_METHOD_PARAM);
|
||||
JsonObject filterParams = new JsonParser().parse(getStringParam(request, ProtocolElements.FILTER_PARAMS_PARAM))
|
||||
JsonObject filterParams = JsonParser.parseString(getStringParam(request, ProtocolElements.FILTER_PARAMS_PARAM))
|
||||
.getAsJsonObject();
|
||||
boolean isModerator = this.sessionManager.isModeratorInSession(rpcConnection.getSessionId(), participant);
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ public class JsonUtils {
|
|||
public JsonElement fromFileToJsonElement(String filePath)
|
||||
throws IOException, FileNotFoundException, JsonParseException, IllegalStateException {
|
||||
JsonElement json = null;
|
||||
JsonParser parser = new JsonParser();
|
||||
FileReader reader = null;
|
||||
try {
|
||||
reader = new FileReader(filePath);
|
||||
|
@ -65,7 +64,7 @@ public class JsonUtils {
|
|||
throw e;
|
||||
}
|
||||
try {
|
||||
json = parser.parse(reader);
|
||||
json = JsonParser.parseReader(reader);
|
||||
} catch (JsonParseException | IllegalStateException exception) {
|
||||
throw exception;
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue