com.google.gson.JsonSyntaxException Java Examples

The following examples show how to use com.google.gson.JsonSyntaxException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepostNewMsgDao.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
public MessageBean sendNewMsg() throws WeiboException {
    String url = WeiBoURLs.REPOST_CREATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("id", id);
    map.put("status", status);
    map.put("is_comment", is_comment);

    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);

    Gson gson = new Gson();

    MessageBean value = null;
    try {
        value = gson.fromJson(jsonData, MessageBean.class);
    } catch (JsonSyntaxException e) {

        AppLoggerUtils.e(e.getMessage());
    }

    return value;

}
 
Example #2
Source File: KeyNameMutatorTest.java    From bender with Apache License 2.0 6 votes vote down vote up
@Test
public void testMutatePayload() throws JsonSyntaxException, IOException, OperationException {
  JsonParser parser = new JsonParser();
  JsonElement input = parser.parse(getResourceString("basic_input.json"));
  String expectedOutput = getResourceString("basic_output_key_name.json");

  DummpyEvent devent = new DummpyEvent();
  devent.payload = input.getAsJsonObject();

  KeyNameOperation operation = new KeyNameOperation();

  InternalEvent ievent = new InternalEvent("", null, 0);
  ievent.setEventObj(devent);
  operation.perform(ievent);

  assertEquals(expectedOutput, input.toString());
}
 
Example #3
Source File: GelfOperationTest.java    From bender with Apache License 2.0 6 votes vote down vote up
@Test
public void testFlattenPrefix()
    throws JsonSyntaxException, UnsupportedEncodingException, IOException {
  JsonParser parser = new JsonParser();

  JsonElement input = parser.parse(getResourceString("flatten_prefixed_input.json"));
  String expectedOutput = getResourceString("flatten_prefixed_output.json");

  DummpyEvent devent = new DummpyEvent();
  devent.payload = input.getAsJsonObject();

  GelfOperation op = new GelfOperation(new ArrayList<>());

  InternalEvent ievent = new InternalEvent("", null, 0);
  ievent.setEventObj(devent);
  op.perform(ievent);

  assertEquals(parser.parse(expectedOutput), devent.payload);
}
 
Example #4
Source File: ShapedCompressingRecipe.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
static String[] getPattern(JsonArray jsonArray_1) {
    String[] strings_1 = new String[jsonArray_1.size()];
    if (strings_1.length > 3) {
        throw new JsonSyntaxException("Invalid pattern: too many rows, 3 is maximum");
    } else if (strings_1.length == 0) {
        throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed");
    } else {
        for (int int_1 = 0; int_1 < strings_1.length; ++int_1) {
            String string_1 = JsonHelper.asString(jsonArray_1.get(int_1), "pattern[" + int_1 + "]");
            if (string_1.length() > 3) {
                throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum");
            }

            if (int_1 > 0 && strings_1[0].length() != string_1.length()) {
                throw new JsonSyntaxException("Invalid pattern: each row must be the same width");
            }

            strings_1[int_1] = string_1;
        }

        return strings_1;
    }
}
 
Example #5
Source File: CapeConfigManager.java    From DeveloperCapes with MIT License 5 votes vote down vote up
public CapeConfig parse(InputStream is) {
    if (is == null) {
        throw new NullPointerException("Can not parse a null input stream!");
    }

    CapeConfig instance = new CapeConfig();
    InputStreamReader isr = new InputStreamReader(is);

    try {
        Map<String, Object> entries = new Gson().fromJson(isr, Map.class);

        for (Map.Entry<String, Object> entry : entries.entrySet()) {
            final String nodeName = entry.getKey();
            final Object obj = entry.getValue();
            if (obj instanceof Map) {
                parseGroup(instance, nodeName, (Map) obj);
            } else if (obj instanceof String) {
            	parseUser(instance, nodeName, (String) obj);
            }
        }
    } catch (JsonSyntaxException e) {
    	DevCapes.logger.error("CapeConfig could not be parsed because:");
        e.printStackTrace();
    }

    return instance;
}
 
Example #6
Source File: LiveClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *删除回调规则。
 * @param req DeleteLiveCallbackRuleRequest
 * @return DeleteLiveCallbackRuleResponse
 * @throws TencentCloudSDKException
 */
public DeleteLiveCallbackRuleResponse DeleteLiveCallbackRule(DeleteLiveCallbackRuleRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DeleteLiveCallbackRuleResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DeleteLiveCallbackRuleResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DeleteLiveCallbackRule"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #7
Source File: CamClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *用户加入到用户组
 * @param req AddUserToGroupRequest
 * @return AddUserToGroupResponse
 * @throws TencentCloudSDKException
 */
public AddUserToGroupResponse AddUserToGroup(AddUserToGroupRequest req) throws TencentCloudSDKException{
    JsonResponseModel<AddUserToGroupResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<AddUserToGroupResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "AddUserToGroup"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #8
Source File: IotcloudClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *本接口(DeleteDevice)用于删除物联网通信设备。 
 * @param req DeleteDeviceRequest
 * @return DeleteDeviceResponse
 * @throws TencentCloudSDKException
 */
public DeleteDeviceResponse DeleteDevice(DeleteDeviceRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DeleteDeviceResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DeleteDeviceResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DeleteDevice"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #9
Source File: GaapClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *删除已添加的源站(服务器)IP或域名
 * @param req RemoveRealServersRequest
 * @return RemoveRealServersResponse
 * @throws TencentCloudSDKException
 */
public RemoveRealServersResponse RemoveRealServers(RemoveRealServersRequest req) throws TencentCloudSDKException{
    JsonResponseModel<RemoveRealServersResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<RemoveRealServersResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "RemoveRealServers"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #10
Source File: KylinErrorResponse.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
public static KylinErrorResponse fromJson(String json) {
  try {
    return gson.fromJson(json, KylinErrorResponse.class);
  } catch (JsonSyntaxException ex) {
    return null;
  }
}
 
Example #11
Source File: YunjingClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *本接口(RecoverMalwares)用于批量恢复已经被隔离的木马文件。
 * @param req RecoverMalwaresRequest
 * @return RecoverMalwaresResponse
 * @throws TencentCloudSDKException
 */
public RecoverMalwaresResponse RecoverMalwares(RecoverMalwaresRequest req) throws TencentCloudSDKException{
    JsonResponseModel<RecoverMalwaresResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<RecoverMalwaresResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "RecoverMalwares"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #12
Source File: OcrClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *本接口支持图像英文文字的检测和识别,返回文字框位置与文字内容。支持多场景、任意版面下的英文、字母、数字和常见字符的识别,同时覆盖英文印刷体和英文手写体识别。
 * @param req EnglishOCRRequest
 * @return EnglishOCRResponse
 * @throws TencentCloudSDKException
 */
public EnglishOCRResponse EnglishOCR(EnglishOCRRequest req) throws TencentCloudSDKException{
    JsonResponseModel<EnglishOCRResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<EnglishOCRResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "EnglishOCR"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #13
Source File: JsonUtil.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
public static JsonElement parse(String s)
        throws SwarmServerResponseException {
    try {
        JsonElement el = PARSER.parse(s);
        if (el != null) {
            return el;
        }
        throw new SwarmServerResponseException("Swarm did not return an object: " + s);
    } catch (JsonSyntaxException e) {
        throw new SwarmServerResponseException("Swarm did not return a JSON object: " + s, e);
    }
}
 
Example #14
Source File: TkeClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 * 查询集群下节点实例信息 
 * @param req DescribeClusterInstancesRequest
 * @return DescribeClusterInstancesResponse
 * @throws TencentCloudSDKException
 */
public DescribeClusterInstancesResponse DescribeClusterInstances(DescribeClusterInstancesRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeClusterInstancesResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeClusterInstancesResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeClusterInstances"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #15
Source File: SoeClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *初始化发音评估过程,每一轮评估前进行调用。语音输入模式分为流式模式和非流式模式,流式模式支持数据分片传输,可以加快评估响应速度。评估模式分为词模式和句子模式,词模式会标注每个音节的详细信息;句子模式会有完整度和流利度的评估。
 * @param req InitOralProcessRequest
 * @return InitOralProcessResponse
 * @throws TencentCloudSDKException
 */
public InitOralProcessResponse InitOralProcess(InitOralProcessRequest req) throws TencentCloudSDKException{
    JsonResponseModel<InitOralProcessResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<InitOralProcessResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "InitOralProcess"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #16
Source File: CmqClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *修改订阅属性
 * @param req ModifySubscriptionAttributeRequest
 * @return ModifySubscriptionAttributeResponse
 * @throws TencentCloudSDKException
 */
public ModifySubscriptionAttributeResponse ModifySubscriptionAttribute(ModifySubscriptionAttributeRequest req) throws TencentCloudSDKException{
    JsonResponseModel<ModifySubscriptionAttributeResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<ModifySubscriptionAttributeResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "ModifySubscriptionAttribute"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #17
Source File: DayuClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *修改L4转发规则的会话保持,支持的子产品:高防IP、高防IP专业版
 * @param req ModifyL4KeepTimeRequest
 * @return ModifyL4KeepTimeResponse
 * @throws TencentCloudSDKException
 */
public ModifyL4KeepTimeResponse ModifyL4KeepTime(ModifyL4KeepTimeRequest req) throws TencentCloudSDKException{
    JsonResponseModel<ModifyL4KeepTimeResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<ModifyL4KeepTimeResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "ModifyL4KeepTime"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #18
Source File: GaapClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
     *本接口(BindListenerRealServers)用于TCP/UDP监听器绑定解绑源站。
注意:本接口会解绑之前绑定的源站,绑定本次调用所选择的源站。例如:原来绑定的源站为A,B,C,本次调用的选择绑定的源站为C,D,E,那么调用后所绑定的源站为C,D,E。
     * @param req BindListenerRealServersRequest
     * @return BindListenerRealServersResponse
     * @throws TencentCloudSDKException
     */
    public BindListenerRealServersResponse BindListenerRealServers(BindListenerRealServersRequest req) throws TencentCloudSDKException{
        JsonResponseModel<BindListenerRealServersResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<BindListenerRealServersResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "BindListenerRealServers"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example #19
Source File: GsonValueMapper.java    From graphql-spqr with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T fromInput(Object graphQLInput, Type sourceType, AnnotatedType outputType) throws InputParsingException {
    if (graphQLInput.getClass() == outputType.getType()) {
        return (T) graphQLInput;
    }
    try {
        JsonElement jsonElement = NO_CONVERTERS.toJsonTree(graphQLInput, sourceType);
        return gson.fromJson(jsonElement, outputType.getType());
    } catch (JsonSyntaxException e) {
        throw new InputParsingException(graphQLInput, outputType.getType(), e);
    }
}
 
Example #20
Source File: CatClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *查询用户的告警主题列表
 * @param req DescribeAlarmTopicRequest
 * @return DescribeAlarmTopicResponse
 * @throws TencentCloudSDKException
 */
public DescribeAlarmTopicResponse DescribeAlarmTopic(DescribeAlarmTopicRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeAlarmTopicResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeAlarmTopicResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeAlarmTopic"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #21
Source File: KmsClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *创建白盒密钥。 密钥个数的上限为 50。
 * @param req CreateWhiteBoxKeyRequest
 * @return CreateWhiteBoxKeyResponse
 * @throws TencentCloudSDKException
 */
public CreateWhiteBoxKeyResponse CreateWhiteBoxKey(CreateWhiteBoxKeyRequest req) throws TencentCloudSDKException{
    JsonResponseModel<CreateWhiteBoxKeyResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<CreateWhiteBoxKeyResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "CreateWhiteBoxKey"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #22
Source File: EcmClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *获取机型配置列表
 * @param req DescribeInstanceTypeConfigRequest
 * @return DescribeInstanceTypeConfigResponse
 * @throws TencentCloudSDKException
 */
public DescribeInstanceTypeConfigResponse DescribeInstanceTypeConfig(DescribeInstanceTypeConfigRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeInstanceTypeConfigResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeInstanceTypeConfigResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeInstanceTypeConfig"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #23
Source File: TbaasClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *获取交易详情
 * @param req GetTransactionDetailForUserRequest
 * @return GetTransactionDetailForUserResponse
 * @throws TencentCloudSDKException
 */
public GetTransactionDetailForUserResponse GetTransactionDetailForUser(GetTransactionDetailForUserRequest req) throws TencentCloudSDKException{
    JsonResponseModel<GetTransactionDetailForUserResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<GetTransactionDetailForUserResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "GetTransactionDetailForUser"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #24
Source File: LiveClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *查询直播域名信息。
 * @param req DescribeLiveDomainRequest
 * @return DescribeLiveDomainResponse
 * @throws TencentCloudSDKException
 */
public DescribeLiveDomainResponse DescribeLiveDomain(DescribeLiveDomainRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeLiveDomainResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeLiveDomainResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeLiveDomain"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #25
Source File: GaapClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *该接口用于查询监听器统计数据,包括出入带宽,出入包量,并发数据。支持300, 3600和86400的细粒度,取值为细粒度范围内最大值。
 * @param req DescribeProxyGroupStatisticsRequest
 * @return DescribeProxyGroupStatisticsResponse
 * @throws TencentCloudSDKException
 */
public DescribeProxyGroupStatisticsResponse DescribeProxyGroupStatistics(DescribeProxyGroupStatisticsRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeProxyGroupStatisticsResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeProxyGroupStatisticsResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeProxyGroupStatistics"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #26
Source File: GitConfigProvisioner.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
private Pair<String, String> getUserFromPreferences()
    throws ServerException, JsonSyntaxException {
  String preferenceJson = getPreferenceJson(PREFERENCES_KEY_FILTER);
  Map<String, Object> preferences = getMapFromJsonObject(preferenceJson);

  String name = getStringValueOrNull(preferences, GIT_USER_NAME_PROPERTY);
  String email = getStringValueOrNull(preferences, GIT_USER_EMAIL_PROPERTY);

  return isNullOrEmpty(name) && isNullOrEmpty(email) ? null : Pair.of(name, email);
}
 
Example #27
Source File: LiveClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *删除录制模板。
 * @param req DeleteLiveRecordTemplateRequest
 * @return DeleteLiveRecordTemplateResponse
 * @throws TencentCloudSDKException
 */
public DeleteLiveRecordTemplateResponse DeleteLiveRecordTemplate(DeleteLiveRecordTemplateRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DeleteLiveRecordTemplateResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DeleteLiveRecordTemplateResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DeleteLiveRecordTemplate"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #28
Source File: TciClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *建立词汇库
 * @param req CreateVocabLibRequest
 * @return CreateVocabLibResponse
 * @throws TencentCloudSDKException
 */
public CreateVocabLibResponse CreateVocabLib(CreateVocabLibRequest req) throws TencentCloudSDKException{
    JsonResponseModel<CreateVocabLibResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<CreateVocabLibResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "CreateVocabLib"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #29
Source File: BmlbClient.java    From tencentcloud-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 *修改黑石负载均衡四层监听器后端探测端口。
 * @param req ModifyL4BackendProbePortRequest
 * @return ModifyL4BackendProbePortResponse
 * @throws TencentCloudSDKException
 */
public ModifyL4BackendProbePortResponse ModifyL4BackendProbePort(ModifyL4BackendProbePortRequest req) throws TencentCloudSDKException{
    JsonResponseModel<ModifyL4BackendProbePortResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<ModifyL4BackendProbePortResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "ModifyL4BackendProbePort"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example #30
Source File: JsonElementResolverTest.java    From trimou with Apache License 2.0 5 votes vote down vote up
@Test
public void testUnwrapJsonArray()
        throws JsonIOException, JsonSyntaxException, FileNotFoundException {

    MustacheEngine engine = getEngine();
    assertEquals("Jim,true,5",
            engine.compileMustache("json_unwrap_array_element_test",
                    "{{#aliases}}{{unwrapThis}}{{#iterHasNext}},{{/iterHasNext}}{{/aliases}}")
                    .render(loadJsonData()));
    assertEquals("Jim,true,5",
            engine.compileMustache("json_unwrap_array_element_test2",
                    "{{#this}}{{unwrapThis}}{{#iterHasNext}},{{/iterHasNext}}{{/this}}")
                    .render(loadJsonData("data_array.json")));
}