From fd3ed7e2d625280f6b78514425f796822f4398c3 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 7 May 2015 12:10:53 +0200 Subject: [PATCH] No error-out on missing upload file, mkjsf-16 Ignores no-file-selected before clicking Init - rather than throwing javax.el.ELException. --- .../mkjsf/pazpar2/commands/sp/InitDocUpload.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitDocUpload.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitDocUpload.java index 0b164a2..2f386e0 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitDocUpload.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/InitDocUpload.java @@ -34,13 +34,17 @@ public class InitDocUpload extends FileUpload { } public void setUploadedFile(UploadedFile uploadedFile) { - logger.info(Utils.objectId(this) + " received an uploaded file [" + Utils.objectId(uploadedFile) + "]"); - this.uploadedFile = uploadedFile; - try { - logger.info("File length: " + this.uploadedFile.getBytes().length); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + if (uploadedFile != null) { + logger.info(Utils.objectId(this) + " received an uploaded file [" + Utils.objectId(uploadedFile) + "]"); + this.uploadedFile = uploadedFile; + try { + logger.info("File length: " + this.uploadedFile.getBytes().length); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + logger.info("Was asked to upload file, but no file specified"); } } -- 1.7.10.4