diff --git a/src/fr/devinsy/xidyn/presenters/URLPresenter.java b/src/fr/devinsy/xidyn/presenters/URLPresenter.java index db76b31..8511c7b 100644 --- a/src/fr/devinsy/xidyn/presenters/URLPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/URLPresenter.java @@ -197,31 +197,51 @@ public class URLPresenter extends StringPresenter public void setSource(final String source) { // - URL url; if (source == null) { - url = null; - } - else if (source.matches(".+://.+")) - { - try - { - url = new URL(source); - } - catch (final MalformedURLException exception) - { - // TODO - logger.warn("UNKNOWN PROTOCOL [" + source + "]"); - url = null; - } + this.source = null; + this.sourcePathname = null; + this.sourceTime = 0; + super.setSource(null); } else { - url = URLPresenter.class.getResource(source); - } + // + URL url; + if (source.matches(".+://.+")) + { + try + { + url = new URL(source); + } + catch (final MalformedURLException exception) + { + // TODO + logger.warn("UNKNOWN PROTOCOL [" + source + "]"); + url = null; + } + } + else + { + url = URLPresenter.class.getResource(source); + } - // - setSource(url); + // + if (url == null) + { + this.source = null; + this.sourcePathname = source; + this.sourceTime = 0; + super.setSource(null); + } + else + { + this.source = url; + this.sourcePathname = source; + this.sourceTime = 0; + super.setSource(null); + } + } } /** @@ -282,7 +302,7 @@ public class URLPresenter extends StringPresenter // if (this.source == null) { - String errorMessage = "source not defined"; + String errorMessage = "source not defined (" + this.sourcePathname + ")"; logger.error(errorMessage); throw new NullPointerException(errorMessage); }