No error-out on missing upload file, mkjsf-16
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 7 May 2015 10:10:53 +0000 (12:10 +0200)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 7 May 2015 10:10:53 +0000 (12:10 +0200)
Ignores no-file-selected before clicking Init - rather than
throwing javax.el.ELException.

src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitDocUpload.java

index 0b164a2..2f386e0 100644 (file)
@@ -34,13 +34,17 @@ public class InitDocUpload extends FileUpload {
   }\r
 \r
   public void setUploadedFile(UploadedFile uploadedFile) {\r
-    logger.info(Utils.objectId(this) + " received an uploaded file [" + Utils.objectId(uploadedFile) + "]");\r
-    this.uploadedFile = uploadedFile;\r
-    try {\r
-      logger.info("File length: " + this.uploadedFile.getBytes().length);\r
-    } catch (IOException e) {\r
-      // TODO Auto-generated catch block\r
-      e.printStackTrace();\r
+    if (uploadedFile != null) {\r
+      logger.info(Utils.objectId(this) + " received an uploaded file [" + Utils.objectId(uploadedFile) + "]");\r
+      this.uploadedFile = uploadedFile;\r
+      try {\r
+        logger.info("File length: " + this.uploadedFile.getBytes().length);\r
+      } catch (IOException e) {\r
+        // TODO Auto-generated catch block\r
+        e.printStackTrace();\r
+      }\r
+    } else {\r
+      logger.info("Was asked to upload file, but no file specified");\r
     }\r
   }\r
   \r