modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 23 ++++++++++ 1 file changed, 23 insertions(+)
New commits: commit 8b80b44154d9d28510c99496294b75b5d8ce73dd Author: Thomas Segismont tsegismo@redhat.com Date: Thu Oct 3 17:21:48 2013 +0200
Fail startup if java.io.tmpdir does not exist, is not readable or is not writable
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java index f0912fc..d5878c6 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java @@ -174,6 +174,9 @@ public class StartupBean implements StartupLocal { */ @Override public void init() throws RuntimeException { + + checkTempDir(); + secureNaming();
initialized = false; @@ -230,6 +233,26 @@ public class StartupBean implements StartupLocal { return; }
+ private void checkTempDir() { + File tmpDir = new File(System.getProperty("java.io.tmpdir")); + if (!tmpDir.exists()) { + throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath() + + "' does not exist"); + } + if (!tmpDir.isDirectory()) { + throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath() + + "' is not a directory"); + } + if (!tmpDir.canRead() || !tmpDir.canExecute()) { + throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath() + + "' is not readable"); + } + if (!tmpDir.canWrite()) { + throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath() + + "' is not writable"); + } + } + private long readShutdownTimeLogFile() throws Exception { File timeFile = shutdownListener.getShutdownTimeLogFile(); if (!timeFile.exists()) {
rhq-commits@lists.fedorahosted.org