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