[sonar] fix

This commit is contained in:
zhongchao
2023-10-18 19:42:58 +08:00
parent 523ae08c5a
commit c265850024
24 changed files with 91 additions and 139 deletions

View File

@@ -29,6 +29,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
@@ -68,7 +69,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas
if (mMarkerEntity != null) {
CallerLogger.d(M_V2X + TAG, "----- show --- 2 --:\n" + mMarkerEntity);
String v2xType = getV2XTypeForFrontWarning(mMarkerEntity);
V2XMessageEntity entity = getV2XMessageEntity();
// V2XMessageEntity entity = getV2XMessageEntity();
if (!v2xType.equals("0")) {
if (getAlertContentForFrontWarning(mMarkerEntity).toString() == null
|| getAlertContentForFrontWarning(mMarkerEntity).toString().isEmpty()
@@ -112,8 +113,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas
private CharSequence getAlertContentForFrontWarning(V2XWarningTarget entity) {
double dis = entity.getDistance();
//距离四舍五入保留整数
BigDecimal bg = new BigDecimal(dis);
double disBig = bg.setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
BigDecimal bg = BigDecimal.valueOf(dis);
double disBig = bg.setScale(0, RoundingMode.HALF_UP).doubleValue();
String distance = String.format(Locale.getDefault(), "%.0f", disBig) + "";
String content = entity.getWarningContent();
SpannableStringBuilder ssb = new SpannableStringBuilder(content + distance);

View File

@@ -48,10 +48,10 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
private RecyclerView rvTopicList;
private TopicListAdapter topicListAdapter;
private String searchStr;
private List<TopicEntity> allTopicList = new ArrayList<>();
private final List<TopicEntity> allTopicList = new ArrayList<>();
private RecordTypeEntity recordType;
private List<String> addTopicList = new ArrayList<>();
private List<TopicEntity> searchTopicList = new ArrayList<>();
private final List<String> addTopicList = new ArrayList<>();
private final List<TopicEntity> searchTopicList = new ArrayList<>();
public CaseTopicListDialog(@NonNull Context context) {
super(context, R.style.bad_case_dialog);

View File

@@ -60,8 +60,10 @@ public class RemoteUserServiceImp extends Binder implements IUserInterface {
String _arg0;
_arg0 = data.readString();
String _result = this.exec(_arg0);
reply.writeNoException();
reply.writeString(_result);
if (reply != null) {
reply.writeNoException();
reply.writeString(_result);
}
return true;
default:
return super.onTransact(code, data, reply, flags);

View File

@@ -249,11 +249,7 @@ public class LogItemAdapter extends AbsRecyclerAdapter<AbsViewBinder<LogLine>, L
protected void publishResults(CharSequence constraint, FilterResults results) {
//noinspection unchecked
mList = (List<LogLine>) results.values;
if (results.count > 0) {
notifyDataSetChanged();
} else {
notifyDataSetChanged();
}
notifyDataSetChanged();
}
}
}

View File

@@ -25,6 +25,7 @@ public class LogLine {
"\\): ");
private static final String filterPattern = "ResourceType|memtrack|android.os.Debug|BufferItemConsumer|DPM.*|MDM.*|ChimeraUtils|BatteryExternalStats.*|chatty.*|DisplayPowerController|WidgetHelper|WearableService|DigitalWidget.*|^ANDR-PERF-.*";
private static final String failPattern = "^maxLineHeight.*|Failed to read.*";
private int logLevel;
private String tag;
private String logOutput;
@@ -57,7 +58,7 @@ public class LogLine {
char logLevelChar = matcher.group(1).charAt(0);
String logText = originalLine.substring(matcher.end());
if (logText.matches("^maxLineHeight.*|Failed to read.*")) {
if (logText.matches(failPattern)) {
logLine.setLogLevel(convertCharToLogLevel('V'));
} else {
logLine.setLogLevel(convertCharToLogLevel(logLevelChar));

View File

@@ -120,10 +120,12 @@ public class TrackManager {
trackObj = new TrackObj(data,s2CellId,s2LatLng);
}
}
mFilterTrafficData.put(uuid, trackObj.getCache());
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
mMarkersCaches.put(uuid, trackObj);
trafficDataUuid.add(uuid);
if(trackObj != null){
mFilterTrafficData.put(uuid, trackObj.getCache());
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
mMarkersCaches.put(uuid, trackObj);
trafficDataUuid.add(uuid);
}
//Log.i("costTime","" + (System.currentTimeMillis() - cost));
}
return mFilterTrafficData;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.smp;
package com.mogo.eagle.core.function.utils;
import com.mogo.eagle.core.data.map.MogoLatLng;
@@ -6,7 +6,6 @@ import java.util.List;
public class RoutePathConvertUtils {
public List<MogoLatLng> routeList;
public int ROUTE_LEFT = 1;
@@ -21,7 +20,7 @@ public class RoutePathConvertUtils {
double v1x = latLng1.lat - latLng0.lat;
double v1y = latLng1.lon - latLng0.lon;
double v2x = latLng2.lat - latLng1.lat;
double v2y = latLng2.lon - latLng2.lon;
double v2y = latLng2.lon - latLng1.lon;
double r = v1x* v2y - v1y*v2x;
if (r > 0.0){
route_direction = ROUTE_LEFT;