morten      01/09/18 01:23:56

  Modified:    java/src/org/apache/xalan/xsltc/cmdline Compile.java
  Log:
  Added '-s' option to command-line compilaton tool to precent calls to
  System.exit(); This is needed when the command-line tool is invoked by
  our Java-based test harness.
  PR:           n/a
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.4       +14 -5     xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Compile.java
  
  Index: Compile.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Compile.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Compile.java      2001/07/19 18:48:31     1.3
  +++ Compile.java      2001/09/18 08:23:56     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Compile.java,v 1.3 2001/07/19 18:48:31 morten Exp $
  + * @(#)$Id: Compile.java,v 1.4 2001/09/18 08:23:56 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -79,6 +79,12 @@
   
   public final class Compile {
   
  +    // This variable should be set to false to prevent any methods in this 
  +    // class from calling System.exit(). As this is a command-line tool,
  +    // calling System.exit() is normally OK, but we also want to allow for
  +    // this class being used in other ways as well.
  +    private static boolean _allowExit = true;
  +
       private final static String USAGE_STRING =
        "Usage:\n" + 
        "   xsltc [-o <output>] [-d <directory>] [-j <jarfile>]\n"+
  @@ -95,7 +101,7 @@
       
       public static void printUsage() {
        System.err.println(USAGE_STRING);
  -     System.exit(-1);
  +     if (_allowExit) System.exit(-1);
       }
   
       /** 
  @@ -136,6 +142,9 @@
                case 'u':
                    inputIsURL = true;
                    break;
  +             case 's':
  +                 _allowExit = false;
  +                 break;
                case 'h':
                default:
                    printUsage();
  @@ -160,12 +169,12 @@
            if (xsltc.compile(stylesheetVector)) {
                xsltc.printWarnings();
                if (xsltc.getJarFileName() != null) xsltc.outputToJar();
  -             System.exit(0);
  +             if (_allowExit) System.exit(0);
            }
            else {
                xsltc.printWarnings();
                xsltc.printErrors();
  -             System.exit(-1);
  +             if (_allowExit) System.exit(-1);
            }
        }
        catch (GetOptsException ex) {
  @@ -174,7 +183,7 @@
        }
        catch (Exception e) {
            e.printStackTrace();
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to