Fix bad pathname settings.
This commit is contained in:
parent
5912bf9079
commit
9daeb06fc4
1 changed files with 40 additions and 20 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue