[sonar] merge
This commit is contained in:
@@ -6,13 +6,13 @@ import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class M3DCar {
|
||||
private Context context;
|
||||
private int resid;
|
||||
private final Context context;
|
||||
private final int redis;
|
||||
public byte[] totBuffer = null;
|
||||
public int totSize = 0;
|
||||
|
||||
public M3DCar(Context context, int resid) {
|
||||
this.resid = resid;
|
||||
public M3DCar(Context context, int redis) {
|
||||
this.redis = redis;
|
||||
this.context = context;
|
||||
loadData();
|
||||
}
|
||||
@@ -20,12 +20,12 @@ public class M3DCar {
|
||||
private void loadData() {
|
||||
if (null != totBuffer)
|
||||
return;
|
||||
DataInputStream dis = new DataInputStream(context.getResources().openRawResource(resid));
|
||||
;
|
||||
int curTotSize = 64 * 1024;
|
||||
totBuffer = new byte[curTotSize];
|
||||
byte[] buffer = new byte[1024];
|
||||
int size = 0;
|
||||
try {
|
||||
int size;
|
||||
try(DataInputStream dis = new DataInputStream(context.getResources().openRawResource(redis))) {
|
||||
while ((size = dis.read(buffer)) >= 0) {
|
||||
if (totSize + size > curTotSize) {
|
||||
curTotSize = (totSize + size) * 3 / 2;
|
||||
@@ -36,8 +36,8 @@ public class M3DCar {
|
||||
System.arraycopy(buffer, 0, totBuffer, totSize, size);
|
||||
totSize += size;
|
||||
}
|
||||
dis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class DirectionLayer extends ImageView implements MapStatusListener {
|
||||
private static final String TAG = "DirectionLayer";
|
||||
private Drawable icon;
|
||||
private IMapController mMapController;
|
||||
private Matrix matrix = new Matrix();
|
||||
private Camera mCamera = new Camera();
|
||||
private final Matrix matrix = new Matrix();
|
||||
private final Camera mCamera = new Camera();
|
||||
|
||||
public DirectionLayer(Context context){
|
||||
super(context);
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class MainInfo {
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
|
||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
|
||||
private static MainInfo m_hinst = null;
|
||||
private boolean mbUserLog = true;
|
||||
private static boolean mbDebug = false;
|
||||
@@ -33,11 +33,9 @@ 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) {
|
||||
}
|
||||
}
|
||||
@@ -50,10 +48,8 @@ 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) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user