MediaLocator ml = this.getLocator();
if(ml == null) throw new NullPointerException("No Medialocator found");
String urlString = "";
try {
if (ml != null) {
if (System.getProperty("file.separator").equals("\\") && ml.getProtocol().equals("file"))
{
String modifiedSource = ml.getURL().toExternalForm();
urlString = modifiedSource.replaceFirst("file:/","file:");
while(modifiedSource.equals(urlString) == false)
{
modifiedSource = urlString;
urlString = modifiedSource.replaceFirst("file:/","file:");
}
}
else
{
try{
urlString = ml.getURL().toString();
}catch(Exception e){
e.printStackTrace();
}
}
}
}
catch (Exception e) {
System.out.println ("Bad URL: " + urlString);
}
return urlString;