Mercurial > hg > digilib
changeset 1171:ac3719dc46ff
fix bug in dlConfig when File is null.
author | robcast |
---|---|
date | Sun, 31 Mar 2013 11:47:24 +0200 |
parents | cf8ecc67200e |
children | d4affe13568c |
files | .hgignore webapp/src/main/webapp/server/dlConfig.jsp |
diffstat | 2 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Thu Mar 28 16:28:52 2013 +0100 +++ b/.hgignore Sun Mar 31 11:47:24 2013 +0200 @@ -111,4 +111,6 @@ syntax: regexp ^servlet/\.classpath$ syntax: regexp -^servlet/\.project$ \ No newline at end of file +^servlet/\.project$ +syntax: regexp +^servlet/bin$ \ No newline at end of file
--- a/webapp/src/main/webapp/server/dlConfig.jsp Thu Mar 28 16:28:52 2013 +0100 +++ b/webapp/src/main/webapp/server/dlConfig.jsp Sun Mar 31 11:47:24 2013 +0200 @@ -84,14 +84,18 @@ } } else if (param.getValue() instanceof java.io.File) { java.io.File f = (java.io.File) param.getValue(); - if (!f.isAbsolute()) { - // relative path -> use getRealPath to resolve - f = new File(pageContext.getServletContext().getRealPath(f.getPath())); - } - if (f.canRead()) { - val = f.toString(); + if (f == null) { + val = "[null]"; } else { - val = "[missing file] "+f.toString(); + if (!f.isAbsolute()) { + // relative path -> use getRealPath to resolve + f = new File(pageContext.getServletContext().getRealPath(f.getPath())); + } + if (f.canRead()) { + val = f.toString(); + } else { + val = "[missing file] "+f.toString(); + } } } else { val = param.getAsString();