diff --git a/src/main/java/de/dennisguse/opentracks/share/DescriptionGenerator.java b/src/main/java/de/dennisguse/opentracks/share/DescriptionGenerator.java index 2058a0fe5a..f8b8f39a2c 100644 --- a/src/main/java/de/dennisguse/opentracks/share/DescriptionGenerator.java +++ b/src/main/java/de/dennisguse/opentracks/share/DescriptionGenerator.java @@ -221,15 +221,15 @@ void writePace(Speed speed, StringBuilder builder, int resId, String lineBreak) } /** - * @param altitude_m altitude_m in meters + * @param altitudeM altitude_m in meters * @param builder StringBuilder to append * @param resId resource id of altitude string * @param lineBreak line break string */ @VisibleForTesting - void writeAltitude(double altitude_m, StringBuilder builder, int resId, String lineBreak) { - long altitudeInM = Math.round(altitude_m); - long altitudeInFt = Math.round(Distance.of(altitude_m).toFT()); + void writeAltitude(double altitudeM, StringBuilder builder, int resId, String lineBreak) { + long altitudeInM = Math.round(altitudeM); + long altitudeInFt = Math.round(Distance.of(altitudeM).toFT()); builder.append(context.getString(resId, altitudeInM, altitudeInFt)); builder.append(lineBreak); } diff --git a/src/main/java/de/dennisguse/opentracks/share/ShareUtils.java b/src/main/java/de/dennisguse/opentracks/share/ShareUtils.java index 7a87241aa0..dad0c542b6 100644 --- a/src/main/java/de/dennisguse/opentracks/share/ShareUtils.java +++ b/src/main/java/de/dennisguse/opentracks/share/ShareUtils.java @@ -17,7 +17,16 @@ import de.dennisguse.opentracks.data.models.Track; import de.dennisguse.opentracks.io.file.TrackFileFormat; import de.dennisguse.opentracks.settings.PreferencesUtils; - +class NoTracksToShareException extends RuntimeException{ + public NoTracksToShareException() + { + super("Did not find any tracks to share."); + } + public NoTracksToShareException(String message) + { + super(message); + } +} public class ShareUtils { private static final String TAG = ShareUtils.class.getSimpleName(); @@ -34,7 +43,7 @@ private ShareUtils() { */ public static Intent newShareFileIntent(Context context, Track.Id... trackIds) { if (trackIds.length == 0) { - throw new RuntimeException("Need to share at least one track."); + throw new NoTracksToShareException("Need to share at least one track."); } ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context); @@ -95,7 +104,8 @@ public static Intent newShareFileIntent(Context context, Marker.Id... markerIds) } if (marker.getPhotoURI() == null) { Log.e(TAG, "MarkerId " + markerId.id() + " has no picture."); - continue; + + } mime = context.getContentResolver().getType(marker.getPhotoURI());