[Android] [PATCH 1/2] utils: Use more Uri

Thomas Guillem thomas at gllm.fr
Fri Jun 5 15:10:19 CEST 2015



On Fri, Jun 5, 2015, at 14:58, Jean-Baptiste Kempf wrote:
> 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 ?

COpy paste from old code, I'll remove it.

> 
> With my kindest regards,
> 
> -- 
> Jean-Baptiste Kempf
> http://www.jbkempf.com/ - +33 672 704 734
> Sent from my Electronic Device
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android


More information about the Android mailing list