|
@@ -21,6 +21,7 @@
|
|
|
*/
|
|
|
package de.mcs.utils.jsap;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.lang.annotation.Annotation;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.lang.reflect.Method;
|
|
@@ -72,7 +73,12 @@ public class CommandlineProcessor {
|
|
|
FileOption annotation = method.getAnnotation(FileOption.class);
|
|
|
if (annotation != null) {
|
|
|
try {
|
|
|
- method.invoke(null, commandLineArgs.getFile(annotation.name()));
|
|
|
+ if (commandLineArgs.contains(annotation.name())) {
|
|
|
+ File file = commandLineArgs.getFile(annotation.name());
|
|
|
+ if ((file.getName() != null) && !"".equals(file.getName())) {
|
|
|
+ method.invoke(null, file);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e1) {
|
|
|
e1.printStackTrace();
|
|
|
}
|