This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit dd924ffe7ba55ca6e640059bb2d44a682f71ef9d Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Oct 28 17:08:30 2014 +0100 Au démarrage de Wao, on contrôle qu'on a bien un répertoire temporaire qui existe (sinon JFreeChart lève une exception) (fixes #6001) --- .../wao/web/DefaultWaoApplicationContext.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java b/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java index db09e28..3976508 100644 --- a/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java +++ b/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java @@ -21,10 +21,12 @@ package fr.ifremer.wao.web; * #L% */ +import com.google.common.base.StandardSystemProperty; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.opensymphony.xwork2.util.LocalizedTextUtil; import fr.ifremer.wao.WaoApplicationConfig; +import fr.ifremer.wao.WaoTechnicalException; import fr.ifremer.wao.WaoTopiaApplicationContext; import fr.ifremer.wao.WaoTopiaPersistenceContext; import fr.ifremer.wao.services.DefaultWaoServiceContext; @@ -42,6 +44,7 @@ import fr.ifremer.wao.services.service.SamplingPlan; import fr.ifremer.wao.services.service.SamplingPlanCacheKey; import fr.ifremer.wao.services.service.Synthesis; import fr.ifremer.wao.services.service.SynthesisCacheKey; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.LogManager; @@ -268,6 +271,8 @@ public class DefaultWaoApplicationContext implements WaoApplicationContext { LocalizedTextUtil.addDefaultResourceBundle("i18n.wao-web"); + checkTempDir(); + WaoTopiaPersistenceContext persistenceContext = newPersistenceContext(); WaoServiceContext serviceContext = newServiceContext(persistenceContext, Locale.FRANCE); @@ -281,4 +286,38 @@ public class DefaultWaoApplicationContext implements WaoApplicationContext { } + protected void checkTempDir() { + + String javaIoTempDirValue = StandardSystemProperty.JAVA_IO_TMPDIR.value(); + if (StringUtils.isBlank(javaIoTempDirValue)) { + throw new WaoTechnicalException(StandardSystemProperty.JAVA_IO_TMPDIR.key() + " is blank"); + } + + File javaIoTempDirFile = new File(javaIoTempDirValue); + + if (javaIoTempDirFile.exists()) { + if (log.isInfoEnabled()) { + log.info("storage directory exists " + javaIoTempDirFile.getAbsolutePath()); + } + } else { + if (log.isInfoEnabled()) { + log.info("storage directory does not exist, creating " + javaIoTempDirFile.getAbsolutePath()); + } + + boolean created = javaIoTempDirFile.mkdirs(); + if ( ! created) { + throw new WaoTechnicalException("unable to create directory " + javaIoTempDirFile.getAbsolutePath()); + } + } + + if ( ! javaIoTempDirFile.isDirectory()) { + throw new WaoTechnicalException("file exists but is not a directory " + javaIoTempDirFile.getAbsolutePath()); + } + + if ( ! javaIoTempDirFile.canWrite()) { + throw new WaoTechnicalException("directory exists but is not writable " + javaIoTempDirFile.getAbsolutePath()); + } + + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.