[Android] [PATCH 1/2] utils: Use more Uri
Jean-Baptiste Kempf
jb at videolan.org
Fri Jun 5 14:58:14 CEST 2015
On 05 Jun, Thomas Guillem wrote :
> ---
> libvlc/src/org/videolan/libvlc/util/AndroidUtil.java | 20 +++++++++++++-------
> vlc-android/src/org/videolan/vlc/MediaLibrary.java | 2 +-
> .../src/org/videolan/vlc/gui/audio/AudioUtil.java | 4 ++--
> .../videolan/vlc/gui/video/VideoPlayerActivity.java | 4 ++--
> 4 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
> index a024203..8ade8f2 100644
> --- a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
> +++ b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
> @@ -66,22 +66,28 @@ public class AndroidUtil {
> return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
> }
>
> - public static File URItoFile(String URI) {
> - if (URI == null) return null;
> - return new File(Uri.decode(URI).replaceFirst("file://", ""));
> + public static File UriToFile(Uri uri) {
> + if (uri == null) throw new NullPointerException("Cannot convert null uri!");
> + return new File(uri.getPath().replaceFirst("file://", ""));
I can't understand how this is correct, tbh.
And why sending a NPE ?
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list