From: Niels Erik G. Nielsen Date: Thu, 7 May 2015 10:10:53 +0000 (+0200) Subject: No error-out on missing upload file, mkjsf-16 X-Git-Tag: v0.0.7~6 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=fd3ed7e2d625280f6b78514425f796822f4398c3;p=mkjsf-moved-to-github.git No error-out on missing upload file, mkjsf-16 Ignores no-file-selected before clicking Init - rather than throwing javax.el.ELException. --- 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"); } }