Skip to content

Commit 5b30282

Browse files
committed
Retrieve plugin path even when manually intializing
1 parent 4789642 commit 5b30282

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

logicaldoc-util/src/main/java/com/logicaldoc/util/plugin/LogicalDOCPlugin.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,19 @@ protected void saveData() throws IOException {
106106
}
107107

108108
/**
109-
* Retrieves the path where the plugins jar archives are stored
109+
* Retrieves the path where the plugin jar archive is stored
110110
*
111-
* @return the path where the plugins jar archives are stored
111+
* @return the path where the plugin jar archive is stored
112112
*/
113113
public String getPluginPath() {
114-
String path = getManager().getPathResolver().resolvePath(getDescriptor(), "/").toString();
115-
if (path.startsWith("jar:file:"))
116-
path = path.substring("jar:file:".length());
117-
path = path.substring(0, path.lastIndexOf("!"));
114+
String path = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
118115
try {
119116
// The path may contain URL-encoded sequences
120117
path = URLDecoder.decode(path, "UTF-8");
121118
} catch (UnsupportedEncodingException e) {
122119
// Nothing to do
123120
}
121+
124122
return path;
125123
}
126124

@@ -274,7 +272,6 @@ protected void addServlet(String name, String servletClass, String mapping) {
274272
protected void addServlet(String name, String servletClass, String mapping, Integer loadOnStartup) {
275273
File dest = new File(getPluginPath());
276274
dest = dest.getParentFile().getParentFile();
277-
278275
WebConfigurator config = new WebConfigurator(dest.getPath() + "/web.xml");
279276
if (loadOnStartup != null)
280277
config.addServlet(name, servletClass, loadOnStartup);

0 commit comments

Comments
 (0)