From: Fredrik Tolf Date: Fri, 16 Oct 2009 01:04:32 +0000 (+0200) Subject: A couple of bugfixes. X-Git-Url: http://dolda2000.com/gitweb/?p=jsvc.git;a=commitdiff_plain;h=83f55da4bce455a30c7519c9a74cad30fb395e11 A couple of bugfixes. --- diff --git a/src/dolda/jsvc/ThreadContext.java b/src/dolda/jsvc/ThreadContext.java index 2d9931e..486bc91 100644 --- a/src/dolda/jsvc/ThreadContext.java +++ b/src/dolda/jsvc/ThreadContext.java @@ -86,9 +86,12 @@ public class ThreadContext extends ThreadGroup { boot.interrupt(); Thread.currentThread().interrupt(); } - if(err[0] != null) + if(err[0] != null) { + destroy(); throw(new RuntimeException(err[0])); + } if(res[0] == null) { + destroy(); logger.log(Level.SEVERE, "No responder returned in spite of no error having happened."); throw(new NullPointerException("No responder returned in spite of no error having happened.")); } diff --git a/src/dolda/jsvc/j2ee/Servlet.java b/src/dolda/jsvc/j2ee/Servlet.java index 2b149c9..d726474 100644 --- a/src/dolda/jsvc/j2ee/Servlet.java +++ b/src/dolda/jsvc/j2ee/Servlet.java @@ -31,7 +31,13 @@ public class Servlet extends HttpServlet { } catch(ClassNotFoundException e) { throw(new ServletException("Invalid JSvc bootstrapper specified", e)); } - tg = new ThreadContext(null, "JSvc service", J2eeContext.create(cfg), bc); + ServerContext ctx = J2eeContext.create(cfg); + String tgn; + if(ctx.name() != null) + tgn = "JSvc service for " + ctx.name(); + else + tgn = "JSvc service"; + tg = new ThreadContext(null, tgn, ctx, bc); } public void destroy() { diff --git a/src/dolda/jsvc/store/FileStore.java b/src/dolda/jsvc/store/FileStore.java index 17a8f88..55c15d7 100644 --- a/src/dolda/jsvc/store/FileStore.java +++ b/src/dolda/jsvc/store/FileStore.java @@ -38,8 +38,10 @@ class FileStore extends Store { this.base = new java.io.File(base, nm.substring(p)); AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - if(!FileStore.this.base.mkdirs()) - throw(new RuntimeException("Could not create store directory (Java won't tell me why)")); + if(!FileStore.this.base.exists()) { + if(!FileStore.this.base.mkdirs()) + throw(new RuntimeException("Could not create store directory (Java won't tell me why)")); + } return(null); } });