Example #1
0
 public File getFileForUri(Uri uri)
 {
     Object obj1 = uri.getEncodedPath();
     int i = ((String) (obj1)).indexOf('/', 1);
     Object obj = Uri.decode(((String) (obj1)).substring(1, i));
     obj1 = Uri.decode(((String) (obj1)).substring(i + 1));
     obj = (File)mRoots.get(obj);
     if (obj == null)
     {
         throw new IllegalArgumentException((new StringBuilder()).append("Unable to find configured root for ").append(uri).toString());
     }
     uri = new File(((File) (obj)), ((String) (obj1)));
     try
     {
         obj1 = uri.getCanonicalFile();
     }
     catch (IOException ioexception)
     {
         throw new IllegalArgumentException((new StringBuilder()).append("Failed to resolve canonical path for ").append(uri).toString());
     }
     if (!((File) (obj1)).getPath().startsWith(((File) (obj)).getPath()))
     {
         throw new SecurityException("Resolved path jumped beyond configured root");
     } else
     {
         return ((File) (obj1));
     }
 }