648540858
2022-11-21 6b03568c5dd128a3d71c02fb1a3a76a4344a4920
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
@@ -1,7 +1,7 @@
package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import okhttp3.*;
import okhttp3.logging.HttpLoggingInterceptor;
@@ -78,6 +78,7 @@
            if (callback == null) {
                try {
                    Response response = client.newCall(request).execute();
                    if (response.isSuccessful()) {
                        ResponseBody responseBody = response.body();
                        if (responseBody != null) {
@@ -85,6 +86,8 @@
                            responseJSON = JSON.parseObject(responseStr);
                        }
                    }else {
                        System.out.println( 2222);
                        System.out.println( response.code());
                        response.close();
                        Objects.requireNonNull(response.body()).close();
                    }
@@ -93,11 +96,11 @@
                    if(e instanceof SocketTimeoutException){
                        //读取超时超时异常
                        logger.error(String.format("读取ZLM数据失败: %s, %s", url, e.getMessage()));
                        logger.error(String.format("读取ZLM数据超时失败: %s, %s", url, e.getMessage()));
                    }
                    if(e instanceof ConnectException){
                        //判断连接异常,我这里是报Failed to connect to 10.7.5.144
                        logger.error(String.format("连接ZLM失败: %s, %s", url, e.getMessage()));
                        logger.error(String.format("连接ZLM连接失败: %s, %s", url, e.getMessage()));
                    }
                }catch (Exception e){
@@ -169,7 +172,6 @@
                    .build();
            Response response = client.newCall(request).execute();
            if (response.isSuccessful()) {
                logger.info("response body contentType: " + Objects.requireNonNull(response.body()).contentType());
                if (targetPath != null) {
                    File snapFolder = new File(targetPath);
                    if (!snapFolder.exists()) {