costin      01/08/21 21:55:33

  Modified:    src/shell shutdown.sh startup.sh tomcat.sh
               src/share/org/apache/tomcat/startup EmbededTomcat.java
                        Main.java
  Log:
  Fix few mistakes, let user override the policy ( but check if the file exists).
  That can be improved, but it should be enough for now.
  
  Revision  Changes    Path
  1.3       +1 -9      jakarta-tomcat/src/shell/shutdown.sh
  
  Index: shutdown.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/shell/shutdown.sh,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- shutdown.sh       1999/12/05 17:02:42     1.2
  +++ shutdown.sh       2001/08/22 04:55:33     1.3
  @@ -1,16 +1,8 @@
   #! /bin/sh
   #
  -# $Id: shutdown.sh,v 1.2 1999/12/05 17:02:42 harishp Exp $
  +# $Id: shutdown.sh,v 1.3 2001/08/22 04:55:33 costin Exp $
   
   # Shell script to shutdown the server
  -
  -# There are other, simpler commands to shutdown the runner. The two
  -# commented commands good replacements. The first works well with
  -# Java Platform 1.1 based runtimes. The second works well with
  -# Java2 Platform based runtimes.
  -
  -#jre -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Shutdown $*
  -#java -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Shutdown $*
   
   BASEDIR=`dirname $0`
   
  
  
  
  1.3       +1 -9      jakarta-tomcat/src/shell/startup.sh
  
  Index: startup.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/shell/startup.sh,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- startup.sh        1999/12/05 17:02:42     1.2
  +++ startup.sh        2001/08/22 04:55:33     1.3
  @@ -1,16 +1,8 @@
   #! /bin/sh
   #
  -# $Id: startup.sh,v 1.2 1999/12/05 17:02:42 harishp Exp $
  +# $Id: startup.sh,v 1.3 2001/08/22 04:55:33 costin Exp $
   
   # Shell script to startup the server
  -
  -# There are other, simpler commands to startup the runner. The two
  -# commented commands good replacements. The first works well with
  -# Java Platform 1.1 based runtimes. The second works well with
  -# Java2 Platform based runtimes.
  -
  -#jre -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
  -#java -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
   
   BASEDIR=`dirname $0`
   
  
  
  
  1.27      +2 -2      jakarta-tomcat/src/shell/tomcat.sh
  
  Index: tomcat.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/shell/tomcat.sh,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- tomcat.sh 2001/08/21 05:55:50     1.26
  +++ tomcat.sh 2001/08/22 04:55:33     1.27
  @@ -1,6 +1,6 @@
   #!/bin/sh
   #
  -# $Id: tomcat.sh,v 1.26 2001/08/21 05:55:50 costin Exp $
  +# $Id: tomcat.sh,v 1.27 2001/08/22 04:55:33 costin Exp $
   
   # Shell script to start and stop the server
   
  @@ -122,7 +122,7 @@
   
   ## -------------------- Process options -------------------- 
   # add tomcat.policy - even if we don't use sandbox, it doesn't hurt
  -TOMCAT_OPTS="$TOMCAT_OPTS -Djava.security.policy==${TOMCAT_HOME}/lib/tomcat.policy "
  +TOMCAT_OPTS="$TOMCAT_OPTS -Djava.security.policy==${TOMCAT_HOME}/conf/tomcat.policy 
"
   
   
   # We start the server up in the background for a couple of reasons:
  
  
  
  1.49      +5 -4      
jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- EmbededTomcat.java        2001/08/22 04:43:23     1.48
  +++ EmbededTomcat.java        2001/08/22 04:55:33     1.49
  @@ -9,6 +9,7 @@
   import org.apache.tomcat.util.IntrospectionUtils;
   import java.security.*;
   import java.util.*;
  +import java.lang.reflect.*;
   
   /* EmbededTomcat is the bean you use to embed tomcat in your application.
      Main is a wrapper that will guess TOMCAT_HOME and dispatch to 
  @@ -409,10 +410,10 @@
                                         modules.elementAt( i ) );
            }
            contextM.init();
  -     } catch( InvocationTargetException rex ) {
  -         debug("exception initializing ContextManager", rex.getTargetException());
  -         throw new TomcatException( "EmbededTomcat.initContextManager", 
ex.getTargetExeption() );
  -     } catch( Exception ex ) {
  +     } catch( Throwable ex ) {
  +         if( ex instanceof InvocationTargetException ) {
  +             ex=((InvocationTargetException)ex).getTargetException();
  +         }
            debug("exception initializing ContextManager", ex);
            throw new TomcatException( "EmbededTomcat.initContextManager", ex );
        }
  
  
  
  1.39      +12 -2     jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- Main.java 2001/08/22 04:43:23     1.38
  +++ Main.java 2001/08/22 04:55:33     1.39
  @@ -1,4 +1,4 @@
  -/* $Id: Main.java,v 1.38 2001/08/22 04:43:23 costin Exp $
  +/* $Id: Main.java,v 1.39 2001/08/22 04:55:33 costin Exp $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -196,7 +196,17 @@
       public void initSecurityFile() {
        if( args.length > 1 &&
            "-sandbox".equals( args[1] ) ) {
  -         if( null == System.getProperty("java.security.policy")) {
  +         String oldPolicy=System.getProperty("java.security.policy");
  +         if( oldPolicy != null ) {
  +             if( oldPolicy.startsWith("=") )
  +                 oldPolicy=oldPolicy.substring(1);
  +             File f=new File( oldPolicy );
  +             if( ! f.exists() ) {
  +                 debug( "Can't find old policy " + oldPolicy );
  +                 oldPolicy=null;
  +             }
  +         }
  +         if( null == oldPolicy ) {
                File f=null;
                String policyFile=installDir + File.separator + "conf" +
                    File.separator + "tomcat.policy";
  
  
  

Reply via email to