[6.2.4] fix sonarbug
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user