com.alibaba.dubbo.common.json.ParseException Java Examples

The following examples show how to use com.alibaba.dubbo.common.json.ParseException. 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: OrderControllerImpl.java    From SpringBoot-Dubbo-Docker-Jenkins with Apache License 2.0 6 votes vote down vote up
private void transferProdIdCountJson(OrderInsertReq orderInsertReq) {
    if (orderInsertReq != null && StringUtils.isNotEmpty(orderInsertReq.getProdIdCountJson())) {
        try {
            Map<String, Long> prodIdCountMapPre = JSON.parse(orderInsertReq.getProdIdCountJson(), Map.class);
            Map<String, Integer> prodIdCountMap = Maps.newHashMap();
            if (prodIdCountMapPre.size() > 0) {
                for (String key : prodIdCountMapPre.keySet()) {
                    prodIdCountMap.put(key, (Integer) prodIdCountMapPre.get(key).intValue());
                }
            }
            orderInsertReq.setProdIdCountMap(prodIdCountMap);
        } catch (ParseException e) {
            throw new CommonBizException(ExpCodeEnum.JSONERROR);
        }
    }

}
 
Example #2
Source File: JsonObjectInput.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public Object readObject() throws IOException, ClassNotFoundException {
    try {
        String json = readLine();
        if (json.startsWith("{")) {
            return JSON.parse(json, Map.class);
        } else {
            json = "{\"value\":" + json + "}";
            
            @SuppressWarnings("unchecked")
            Map<String, Object> map = JSON.parse(json, Map.class);
            return map.get("value");
        }
    } catch (ParseException e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #3
Source File: JsonObjectInput.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public Object readObject() throws IOException, ClassNotFoundException {
    try {
        String json = readLine();
        if (json.startsWith("{")) {
            return JSON.parse(json, Map.class);
        } else {
            json = "{\"value\":" + json + "}";
            
            @SuppressWarnings("unchecked")
            Map<String, Object> map = JSON.parse(json, Map.class);
            return map.get("value");
        }
    } catch (ParseException e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #4
Source File: JsonObjectInput.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public Object readObject() throws IOException, ClassNotFoundException {
    try {
        String json = readLine();
        if (json.startsWith("{")) {
            return JSON.parse(json, Map.class);
        } else {
            json = "{\"value\":" + json + "}";
            
            @SuppressWarnings("unchecked")
            Map<String, Object> map = JSON.parse(json, Map.class);
            return map.get("value");
        }
    } catch (ParseException e) {
        throw new IOException(e.getMessage());
    }
}
 
Example #5
Source File: JsonObjectInput.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public Object readObject() throws IOException, ClassNotFoundException {
    try {
        String json = readLine();
        if (json.startsWith("{")) {
            return JSON.parse(json, Map.class);
        } else {
            json = "{\"value\":" + json + "}";
            
            @SuppressWarnings("unchecked")
            Map<String, Object> map = JSON.parse(json, Map.class);
            return map.get("value");
        }
    } catch (ParseException e) {
        throw new IOException(e.getMessage());
    }
}