[6.2.4] fix sonarbug

This commit is contained in:
zhongchao
2023-12-07 17:07:32 +08:00
parent 02199849e9
commit 96304d6541
8 changed files with 28 additions and 15 deletions

View File

@@ -39,8 +39,10 @@ public class PayloadEncoder {
switch (typeName) {
case "com.autonavi.nge.map.LonLat":
LonLat lonLat = (LonLat) value;
buffer.writeDouble(lonLat.getLon());
buffer.writeDouble(lonLat.getLat());
if(lonLat != null){
buffer.writeDouble(lonLat.getLon());
buffer.writeDouble(lonLat.getLat());
}
break;
case "java.lang.Boolean":
case "kotlin.Boolean":

View File

@@ -2,6 +2,7 @@ package com.zhidaoauto.map.sdk.inner.utils;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -33,12 +34,11 @@ public class MainInfo {
if (null == dir) {
return;
}
try {
FileWriter fw = new FileWriter((dir + "log.txt"), true);
try(FileWriter fw = new FileWriter((dir + "log.txt"), true)){
String date = dateFormat.format(new Date());
fw.write(date + " " + log + "\r\n");
fw.close();
} catch (Exception ex) {
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -50,11 +50,11 @@ public class MainInfo {
if (null == dir) {
return;
}
try {
FileWriter fw = new FileWriter((dir + "log.txt"), true);
try(FileWriter fw = new FileWriter((dir + "log.txt"), true)){
e.printStackTrace(new PrintWriter(fw));
fw.close();
} catch (Exception ex) {
} catch (IOException ex) {
ex.printStackTrace();
}
}