mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-10 09:54:11 +00:00
fix: plugin null bugs
This commit is contained in:
parent
1a444240a0
commit
305cd51854
@ -131,10 +131,10 @@ public class CMHttpServer {
|
|||||||
FileActions.setTextFileSuffixes(cmdConf.textFileSuffixes);
|
FileActions.setTextFileSuffixes(cmdConf.textFileSuffixes);
|
||||||
|
|
||||||
// plugins
|
// plugins
|
||||||
CMHttpHandler.wsPluginActions = cmdConf.wsPluginActions.split(",");
|
CMHttpHandler.wsPluginActions = parseStrAsList(cmdConf.wsPluginActions);
|
||||||
MasterClientFrameHandler.clientToAgentPlugins = cmdConf.clientToAgentPlugins.split(",");
|
MasterClientFrameHandler.clientToAgentPlugins = parseStrAsList(cmdConf.clientToAgentPlugins);
|
||||||
NodeCenterClientHandler.clientToClusterPlugins = cmdConf.clientToClusterPlugins.split(",");
|
NodeCenterClientHandler.clientToClusterPlugins = parseStrAsList(cmdConf.clientToClusterPlugins);
|
||||||
TCPClientFrameHandler.tcpPlugins = cmdConf.tcpPlugins.split(",");
|
TCPClientFrameHandler.tcpPlugins = parseStrAsList(cmdConf.tcpPlugins);
|
||||||
|
|
||||||
if (!cmdConf.debug.isEmpty()) {
|
if (!cmdConf.debug.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -152,6 +152,12 @@ public class CMHttpServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String[] parseStrAsList(String str) {
|
||||||
|
if (str == null)
|
||||||
|
return new String[]{};
|
||||||
|
return str.split(",");
|
||||||
|
}
|
||||||
|
|
||||||
private static void addDirToPath(String s) {
|
private static void addDirToPath(String s) {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("add to path: " + s);
|
LOGGER.info("add to path: " + s);
|
||||||
@ -251,14 +257,19 @@ public class CMHttpServer {
|
|||||||
// if (ContractManager.reconnectPort < 0) ContractManager.reconnectPort = 1630;
|
// if (ContractManager.reconnectPort < 0) ContractManager.reconnectPort = 1630;
|
||||||
File[] pluginJar = new File("./pluginLib/")
|
File[] pluginJar = new File("./pluginLib/")
|
||||||
.listFiles(pathname -> pathname.getName().endsWith(".jar"));
|
.listFiles(pathname -> pathname.getName().endsWith(".jar"));
|
||||||
URL[] urls = new URL[pluginJar.length];
|
URL[] urls;
|
||||||
for (int i = 0; i < pluginJar.length; i++) {
|
if (pluginJar != null && pluginJar.length > 0) {
|
||||||
try {
|
urls = new URL[pluginJar.length];
|
||||||
urls[i] = pluginJar[i].toURI().toURL();
|
for (int i = 0; i < pluginJar.length; i++) {
|
||||||
LOGGER.info("add plugin:" + pluginJar[i].getName());
|
try {
|
||||||
} catch (MalformedURLException e) {
|
urls[i] = pluginJar[i].toURI().toURL();
|
||||||
e.printStackTrace();
|
LOGGER.info("add plugin:" + pluginJar[i].getName());
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
urls = new URL[]{};
|
||||||
}
|
}
|
||||||
pluginLoader = new URLClassLoader(urls, CMHttpServer.class.getClassLoader());
|
pluginLoader = new URLClassLoader(urls, CMHttpServer.class.getClassLoader());
|
||||||
if (port >= 18000 && port < 18100) {
|
if (port >= 18000 && port < 18100) {
|
||||||
|
Loading…
Reference in New Issue
Block a user