mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
fixing bug concerning an error which occurred because of spaces in web application path
This commit is contained in:
@@ -46,11 +46,13 @@ import sonia.scm.util.IOUtil;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@@ -66,6 +68,9 @@ import javax.xml.bind.JAXB;
|
|||||||
public class DefaultPluginLoader implements PluginLoader
|
public class DefaultPluginLoader implements PluginLoader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String ENCODING = "UTF-8";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String PATH_PLUGINCONFIG = "META-INF/scm/plugin.xml";
|
public static final String PATH_PLUGINCONFIG = "META-INF/scm/plugin.xml";
|
||||||
|
|
||||||
@@ -161,6 +166,33 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String decodePath(String path)
|
||||||
|
{
|
||||||
|
File file = new File(path);
|
||||||
|
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
path = URLDecoder.decode(path, ENCODING);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
logger.error(ex.getMessage(), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -199,6 +231,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
String path = url.toExternalForm();
|
String path = url.toExternalForm();
|
||||||
|
|
||||||
path = path.substring("jar:file:".length(), path.lastIndexOf("!"));
|
path = path.substring("jar:file:".length(), path.lastIndexOf("!"));
|
||||||
|
path = decodePath(path);
|
||||||
|
|
||||||
boolean corePlugin = path.matches(REGE_COREPLUGIN);
|
boolean corePlugin = path.matches(REGE_COREPLUGIN);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user