X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FText.java;h=8af4a4084b2a2c91ca3bc0aea7f726c7781bc821;hb=a67248cf983a1370625887c82ed7524e95b56dd1;hp=daa108fc2c6a31fa322ae7b037b079a0206923a5;hpb=d15905f9d78264562da8bbcc36622e4ea4ac4d82;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/Text.java b/src/be/nikiroo/fanfix/supported/Text.java index daa108f..8af4a40 100644 --- a/src/be/nikiroo/fanfix/supported/Text.java +++ b/src/be/nikiroo/fanfix/supported/Text.java @@ -288,6 +288,8 @@ class Text extends BasicSupport { /** * Check if we supports this {@link URL}, that is, if the info file can be * found OR not found. + *
+ * It must also be a file, not another kind of URL. * * @param url * the {@link URL} to check @@ -297,21 +299,23 @@ class Text extends BasicSupport { * @return TRUE if it is supported */ protected boolean supports(URL url, boolean info) { - boolean infoPresent = false; - if ("file".equals(url.getProtocol())) { - File file; - try { - file = new File(url.toURI()); - file = assureNoTxt(file); - file = new File(file.getPath() + ".info"); - } catch (URISyntaxException e) { - Instance.getTraceHandler().error(e); - file = null; - } + if (!"file".equals(url.getProtocol())) { + return false; + } - infoPresent = (file != null && file.exists()); + boolean infoPresent = false; + File file; + try { + file = new File(url.toURI()); + file = assureNoTxt(file); + file = new File(file.getPath() + ".info"); + } catch (URISyntaxException e) { + Instance.getTraceHandler().error(e); + file = null; } + infoPresent = (file != null && file.exists()); + return infoPresent == info; }