morten      01/09/20 08:54:02

  Modified:    java/src/org/apache/xalan/xsltc/cmdline Transform.java
  Log:
  Added functionality behind the '-s' flag in the Transform command-line tool.
  PR:           n/a
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.7       +14 -11    
xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java
  
  Index: Transform.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Transform.java    2001/09/12 14:30:46     1.6
  +++ Transform.java    2001/09/20 15:54:02     1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Transform.java,v 1.6 2001/09/12 14:30:46 morten Exp $
  + * @(#)$Id: Transform.java,v 1.7 2001/09/20 15:54:02 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -100,7 +100,7 @@
       private String  _jarFileSrc;
       private boolean _isJarFileSpecified = false;
       private Vector  _params = null;
  -    private boolean _uri, _debug;
  +    private boolean _uri, _debug, _allowExit = true;
   
       public Transform(String className, String fileName,
                     boolean uri, boolean debug) {
  @@ -207,38 +207,38 @@
        catch (TransletException e) {
            if (_debug) e.printStackTrace();
            System.err.println("\nTranslet Error: " + e.getMessage());
  -         System.exit(-1);        
  +         if (_allowExit) System.exit(-1);        
        }
        catch (RuntimeException e) {
            if (_debug) e.printStackTrace();
            System.err.println("\nRuntime Error: " + e.getMessage());
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
        catch (FileNotFoundException e) {
            if (_debug) e.printStackTrace();
            System.err.println("Error: File or URI '"+_fileName+"' not found.");
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
        catch (MalformedURLException e) {
            if (_debug) e.printStackTrace();
            System.err.println("Error: Invalid URI '"+_fileName+"'.");
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
        catch (ClassNotFoundException e) {
            if (_debug) e.printStackTrace();
            System.err.println("Error: Cannot find class '"+_className+"'.");
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
           catch (UnknownHostException e) {
            if (_debug) e.printStackTrace();
            System.err.println("Error: Can't resolve URI specification '"+ 
                               _fileName+"'.");
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
           }
        catch (Exception e) {
            if (_debug) e.printStackTrace();
            System.err.println("Error: "+e.getMessage());
  -         System.exit(-1);
  +         if (_allowExit) System.exit(-1);
        }
       }
   
  @@ -255,7 +255,7 @@
   
       public static void printUsage() {
        System.err.println(USAGE_STRING);
  -     System.exit(-1);
  +     if (_allowExit) System.exit(-1);
       }
   
       public static void main(String[] args) {
  @@ -274,6 +274,9 @@
                    else if (args[i].equals("-x")) {
                        debug = true;
                    }
  +                 else if (args[i].equals("-s")) {
  +                     _allowExits = false;
  +                 }
                    else if (args[i].equals("-j")) {
                        isJarFileSpecified = true;      
                        jarFile = args[++i];
  @@ -307,7 +310,7 @@
                if (i == args.length) {
                    handler.setParameters(params);
                    handler.doTransform();
  -                 System.exit(0);
  +                 if (_allowExit) System.exit(0);
                }
            } else {
                printUsage();
  
  
  

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

Reply via email to