Commit 7b929499 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Added a little more robustness to installPlugin routine.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9477 b35dd754-fafc-0310-a699-88a17e54d16e
parent f597b6f7
...@@ -130,9 +130,18 @@ public class PluginManager { ...@@ -130,9 +130,18 @@ public class PluginManager {
* @return true if the plugin was successfully installed or updated. * @return true if the plugin was successfully installed or updated.
*/ */
public boolean installPlugin(InputStream in, String pluginFilename) { public boolean installPlugin(InputStream in, String pluginFilename) {
if (in == null || pluginFilename == null || pluginFilename.length() < 1) {
Log.error("Error installing plugin: Input stream was null or pluginFilename was null or had no length.");
return false;
}
try { try {
byte[] b = new byte[1024]; byte[] b = new byte[1024];
int len; int len;
// If pluginFilename is a path instead of a simple file name, we only want the file name
int index = pluginFilename.lastIndexOf(File.separator);
if (index != -1) {
pluginFilename = pluginFilename.substring(index+1);
}
// Absolute path to the plugin file // Absolute path to the plugin file
String absolutePath = pluginDirectory + File.separator + pluginFilename; String absolutePath = pluginDirectory + File.separator + pluginFilename;
// Save input stream contents to a temp file // Save input stream contents to a temp file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment