[change]将InvalidProtocolBufferException捕获更改为Exception。避免业务调用时产生异常引起websocket断开
This commit is contained in:
@@ -18,6 +18,7 @@ import com.zhidao.support.adas.high.common.Base64;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.Define;
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
import com.zhidao.support.adas.high.common.IPCFixationIPHelper;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
@@ -331,9 +332,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
callError(raw.getProtocolStatus(), bytes);
|
||||
}
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
} catch (Exception e) {
|
||||
callError(ProtocolStatus.BUSINESS_DATA_PARSE_FAILED, bytes);
|
||||
e.printStackTrace();
|
||||
CupidLogUtils.e(TAG, "原始数据:" + DigitalTrans.byte2hex(bytes), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,13 @@ public class CupidLogUtils {
|
||||
Log.w("[tag=" + tag + "]", "[data=" + msg + "]");
|
||||
}
|
||||
|
||||
public static void e(String tag, String msg, Throwable throwable) {
|
||||
if (!mIsEnableLog) {
|
||||
return;
|
||||
}
|
||||
Log.e("[tag=" + tag + "]", "[data=" + msg + "]", throwable);
|
||||
}
|
||||
|
||||
public static void e(String tag, String msg) {
|
||||
if (!mIsEnableLog) {
|
||||
return;
|
||||
|
||||
@@ -315,8 +315,7 @@ public class DigitalTrans {
|
||||
*/
|
||||
public static final String byte2hex(byte b[]) {
|
||||
if (b == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Argument b ( byte array ) is null! ");
|
||||
return "";
|
||||
}
|
||||
String hs = "";
|
||||
String stmp = "";
|
||||
@@ -571,6 +570,7 @@ public class DigitalTrans {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static byte[] set8bitUnsignedValue(int num) {
|
||||
return new byte[]{(byte) (num)};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user