forked from upstream-mirrors/OpenTracks
Switch order of literals to prevent NullPointerException (#4)
Co-authored-by: pixeebot[bot] <23113631+pixeebot@users.noreply.github.com>
This commit is contained in:
committed by
Hosted Weblate
parent
aae1a4d65d
commit
83445cfde0
@@ -57,12 +57,12 @@ public class StatisticsUtilsTest extends TestCase {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(resultTrue.getFields().size(), 3);
|
assertEquals(resultTrue.getFields().size(), 3);
|
||||||
assertTrue(resultTrue.getFields().stream().anyMatch(f -> f.getKey().equals("key1")));
|
assertTrue(resultTrue.getFields().stream().anyMatch(f -> "key1".equals(f.getKey())));
|
||||||
assertTrue(resultTrue.getFields().stream().anyMatch(f -> f.getKey().equals("key3")));
|
assertTrue(resultTrue.getFields().stream().anyMatch(f -> "key3".equals(f.getKey())));
|
||||||
assertTrue(resultTrue.getFields().stream().anyMatch(f -> f.getKey().equals("key5")));
|
assertTrue(resultTrue.getFields().stream().anyMatch(f -> "key5".equals(f.getKey())));
|
||||||
|
|
||||||
assertEquals(resultFalse.getFields().size(), 2);
|
assertEquals(resultFalse.getFields().size(), 2);
|
||||||
assertTrue(resultFalse.getFields().stream().anyMatch(f -> f.getKey().equals("key2")));
|
assertTrue(resultFalse.getFields().stream().anyMatch(f -> "key2".equals(f.getKey())));
|
||||||
assertTrue(resultFalse.getFields().stream().anyMatch(f -> f.getKey().equals("key4")));
|
assertTrue(resultFalse.getFields().stream().anyMatch(f -> "key4".equals(f.getKey())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,7 +494,7 @@ public class KMLTrackExporter implements TrackExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeActivityType(String activityTypeLocalized) {
|
private void writeActivityType(String activityTypeLocalized) {
|
||||||
if (activityTypeLocalized == null || activityTypeLocalized.equals("")) {
|
if (activityTypeLocalized == null || "".equals(activityTypeLocalized)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printWriter.println("<ExtendedData>");
|
printWriter.println("<ExtendedData>");
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ public class KmlTrackImporter extends DefaultHandler implements XMLImporter.Trac
|
|||||||
Float value = null;
|
Float value = null;
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
content = content.trim();
|
content = content.trim();
|
||||||
if (!content.equals("")) {
|
if (!"".equals(content)) {
|
||||||
try {
|
try {
|
||||||
value = Float.parseFloat(content);
|
value = Float.parseFloat(content);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ public class KmzTrackImporter {
|
|||||||
*/
|
*/
|
||||||
@Deprecated //TODO Use JDK9's inputStream.transferTo() instead of manual buffer
|
@Deprecated //TODO Use JDK9's inputStream.transferTo() instead of manual buffer
|
||||||
private void readAndSaveImageFile(ZipInputStream zipInputStream, Track.Id trackId, String fileName) throws IOException {
|
private void readAndSaveImageFile(ZipInputStream zipInputStream, Track.Id trackId, String fileName) throws IOException {
|
||||||
if (trackId == null || fileName.equals("")) {
|
if (trackId == null || "".equals(fileName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class TrackListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
String category = activityType == null ? activityTypeLocalized : null;
|
String category = activityType == null ? activityTypeLocalized : null;
|
||||||
String categoryDescription = StringUtils.getCategoryDescription(category, description);
|
String categoryDescription = StringUtils.getCategoryDescription(category, description);
|
||||||
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
|
viewBinding.trackListItemCategoryDescription.setText(categoryDescription);
|
||||||
viewBinding.trackListItemCategoryDescription.setVisibility(categoryDescription.equals("") ? View.GONE : View.VISIBLE);
|
viewBinding.trackListItemCategoryDescription.setVisibility("".equals(categoryDescription) ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
setSelected(selection.get(getLayoutPosition()));
|
setSelected(selection.get(getLayoutPosition()));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -44,8 +44,8 @@ public class RecordingLayoutIO {
|
|||||||
private static DataField fromCSV(String[] fieldParts, @NonNull Resources resources) {
|
private static DataField fromCSV(String[] fieldParts, @NonNull Resources resources) {
|
||||||
return new DataField(
|
return new DataField(
|
||||||
fieldParts[0],
|
fieldParts[0],
|
||||||
fieldParts[1].equals(YES_VALUE),
|
YES_VALUE.equals(fieldParts[1]),
|
||||||
fieldParts[2].equals(YES_VALUE),
|
YES_VALUE.equals(fieldParts[2]),
|
||||||
fieldParts[0].equals(resources.getString(R.string.stats_custom_layout_coordinates_key)));
|
fieldParts[0].equals(resources.getString(R.string.stats_custom_layout_coordinates_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user