<div dir="ltr"><div>Got it, thanks.</div><div><br></div><div>diff --git a/src/libbluray/bdj/java/java/io/BDFileSystem.java b/src/libbluray/bdj/java/java/io/BDFileSystem.java</div><div>index 687a228..7dcbeaf 100644</div><div>--- a/src/libbluray/bdj/java/java/io/BDFileSystem.java</div><div>+++ b/src/libbluray/bdj/java/java/io/BDFileSystem.java</div><div>@@ -44,6 +44,25 @@ public abstract class BDFileSystem extends FileSystem {</div><div><br></div><div> protected final FileSystem fs;</div><div><br></div><div>+ private static FileSystem nativeFileSystem;</div><div>+</div><div>+ static {</div><div>+ /* Java 8: getFileSystem() no longer exists on java.io.FileSystem */</div><div>+ try {</div><div>+ nativeFileSystem = (FileSystem)Class.forName("java.io.DefaultFileSystem")</div><div>+ .getDeclaredMethod("getFileSystem", new Class[0])</div><div>+ .invoke(null, new Object[0]);</div><div>+ } catch (ReflectiveOperationException e) {</div><div>+ try {</div><div>+ nativeFileSystem = (FileSystem)FileSystem.class</div><div>+ .getDeclaredMethod("getFileSystem",new Class[0])</div><div>+ .invoke(null, new Object[0]);</div><div>+ } catch (ReflectiveOperationException t) {</div><div>+ System.err.print("Couldn't find native filesystem: " + t);</div><div>+ }</div><div>+ }</div><div>+ }</div><div>+</div><div> public static void init(final Class c) {</div><div> AccessController.doPrivileged(</div><div> new PrivilegedAction() {</div><div>@@ -77,11 +96,11 @@ public abstract class BDFileSystem extends FileSystem {</div><div> }</div><div><br></div><div> public static String[] nativeList(File f) {</div><div>- return getFileSystem().list(f);</div><div>+ return nativeFileSystem.list(f);</div><div> }</div><div><br></div><div> public static boolean nativeFileExists(String path) {</div><div>- return getFileSystem().getBooleanAttributes(new File(path)) != 0;</div><div>+ return nativeFileSystem.getBooleanAttributes(new File(path)) != 0;</div><div> }</div><div><br></div><div> /*</div><div>--</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 26, 2015 at 11:21 PM, Petri Hintukainen <span dir="ltr"><<a href="mailto:phintuka@users.sourceforge.net" target="_blank">phintuka@users.sourceforge.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On ti, 2015-02-24 at 23:09 -0800, Zach Rait wrote:<br>
> I'm not sure how to propose a patch as I don't see any recent examples, but I've included<br>
> what I'd like to push below. Please let me know what the best way to contribute to this<br>
> project is—I didn't see any guidelines at <a href="http://www.videolan.org/developers/libbluray.html" target="_blank">http://www.videolan.org/developers/libbluray.html</a>,<br>
> but I may have missed something obvious.<br>
<br>
</span>Posting patches to this list is fine.<br>
<span class=""><br>
><br>
> [PATCH] Fix Java 8 build break with getFileSystem()<br>
><br>
><br>
><br>
> Unfortunately java.io.FileSystem.getFileSystem() was removed in Java 8,<br>
> so the addition of calls to it in 7fc6531ea0 broke compilation under Java 8<br>
> ---<br>
> src/libbluray/bdj/java/java/io/BDFileSystem.java | 21 ++++++++++++++++++---<br>
> 1 file changed, 18 insertions(+), 3 deletions(-)<br>
><br>
><br>
> diff --git a/src/libbluray/bdj/java/java/io/BDFileSystem.java b/src/libbluray/bdj/java/java/io/BDFileSystem.java<br>
> index 9800022..a6892a5 100644<br>
> --- a/src/libbluray/bdj/java/java/io/BDFileSystem.java<br>
> +++ b/src/libbluray/bdj/java/java/io/BDFileSystem.java<br>
> @@ -42,6 +42,8 @@ public abstract class BDFileSystem extends FileSystem {<br>
><br>
><br>
> protected final FileSystem fs;<br>
><br>
><br>
> + private static FileSystem nativeFileSystem;<br>
> +<br>
> public static void init(Class c) {<br>
> Field filesystem;<br>
> try {<br>
> @@ -62,18 +64,31 @@ public abstract class BDFileSystem extends FileSystem {<br>
> } catch (Throwable t) {<br>
> System.err.print("Hooking FileSystem class failed: " + t);<br>
> }<br>
> + /* Java 8: getFileSystem() no longer exists on java.io.FileSystem */<br>
> + try {<br>
> + Class.forName("java.io.DefaultFileSystem");<br>
> + nativeFileSystem = DefaultFileSystem.getFileSystem();<br>
<br>
</span>This will not compile with older Java (DefaultFileSystem does not<br>
exist). You need to use reflection also here.<br>
<span class=""><br>
> + } catch (ClassNotFoundException e) {<br>
> + try {<br>
> + nativeFileSystem = (FileSystem)FileSystem.class<br>
> + .getDeclaredMethod("getFileSystem",new Class[0])<br>
> + .invoke(FileSystem.class, new Object[0]);<br>
> + } catch (Throwable t) {<br>
> + System.err.print("Couldn't find native filesystem: " + t);<br>
> + }<br>
> + }<br>
> }<br>
><br>
<br>
</span>Following functions are called before any Xlet is loaded (and init()<br>
called). nativeFileSystem field should be initialized in static {}<br>
block.<br>
<span class=""><br>
> public static String[] nativeList(File f) {<br>
> - return getFileSystem().list(f);<br>
> + return nativeFileSystem.list(f);<br>
> }<br>
><br>
><br>
> public static boolean nativeFileExists(String path) {<br>
> - return getFileSystem().getBooleanAttributes(new File(path)) != 0;<br>
> + return nativeFileSystem.getBooleanAttributes(new File(path)) != 0;<br>
> }<br>
><br>
><br>
> public static boolean nativeDelete(File f) {<br>
> - return getFileSystem().delete(f);<br>
> + return nativeFileSystem.delete(f);<br>
> }<br>
><br>
> /*<br>
> --<br>
</span>> _______________________________________________<br>
> libbluray-devel mailing list<br>
> <a href="mailto:libbluray-devel@videolan.org">libbluray-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/libbluray-devel" target="_blank">https://mailman.videolan.org/listinfo/libbluray-devel</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
libbluray-devel mailing list<br>
<a href="mailto:libbluray-devel@videolan.org">libbluray-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/libbluray-devel" target="_blank">https://mailman.videolan.org/listinfo/libbluray-devel</a><br>
</blockquote></div><br></div>