summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/openslx/imagemaster/Globals.java12
-rw-r--r--src/main/java/org/openslx/imagemaster/server/ApiServer.java5
-rw-r--r--src/test/java/org/openslx/imagemaster/AppTest.java2
3 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/org/openslx/imagemaster/Globals.java b/src/main/java/org/openslx/imagemaster/Globals.java
index 653e255..7dbbae4 100644
--- a/src/main/java/org/openslx/imagemaster/Globals.java
+++ b/src/main/java/org/openslx/imagemaster/Globals.java
@@ -22,14 +22,22 @@ public class Globals {
public static final String ldapSearchFilter = "ldap_search_filter";
public static boolean propertiesValid() {
- if (Globals.properties.getProperty(ftpBaseDir).isEmpty()
+ if (Globals.properties.getProperty(ftpBaseDir) == null
+ || Globals.properties.getProperty(ftpBaseDir).isEmpty()
+ || Globals.properties.getProperty(imageDir) == null
|| Globals.properties.getProperty(imageDir).isEmpty()
+ || Globals.properties.getProperty(ldapPort) == null
|| Globals.properties.getProperty(ldapPort).isEmpty()
+ || Globals.properties.getProperty(ldapHost) == null
|| Globals.properties.getProperty(ldapHost).isEmpty()
+ || Globals.properties.getProperty(ldapSsl) == null
|| Globals.properties.getProperty(ldapSsl).isEmpty()
+ || Globals.properties.getProperty(ldapBindQuery) == null
|| Globals.properties.getProperty(ldapBindQuery).isEmpty()
+ || Globals.properties.getProperty(ldapSearchBaseDn) == null
|| Globals.properties.getProperty(ldapSearchBaseDn).isEmpty()
- || Globals.properties.getProperty(ldapSearchBaseDn).isEmpty()
+ || Globals.properties.getProperty(ldapSearchFilter) == null
+ || Globals.properties.getProperty(ldapSearchFilter).isEmpty()
) {
return false;
}
diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
index 1fcfa49..df0aa3a 100644
--- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java
+++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
@@ -97,6 +97,11 @@ public class ApiServer {
// create new user
FtpCredentials ftpCredentials = Globals.ftpServer.addUser(serverSessionId);
+ if (ftpCredentials == null) {
+ log.error("Could not create ftp credentials");
+ return null;
+ }
+
if (!ImageProcessor.addImageDataToProcess(imageDescription, ftpCredentials.username)) {
Globals.ftpServer.removeUser(serverSessionId);
throw new TException("ImageData is not valid.");
diff --git a/src/test/java/org/openslx/imagemaster/AppTest.java b/src/test/java/org/openslx/imagemaster/AppTest.java
index a491242..89e72c1 100644
--- a/src/test/java/org/openslx/imagemaster/AppTest.java
+++ b/src/test/java/org/openslx/imagemaster/AppTest.java
@@ -80,7 +80,7 @@ public class AppTest
}
/**
- * Test the server authentication.
+ * Test the server authentication and FTP Upload.
* @throws TException
* @throws IOException
* @throws SocketException