You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/08/08 04:10:01 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt Process.java

sboag       00/08/07 19:10:01

  Modified:    src/org/apache/xalan/xslt Process.java
  Log:
  Exit status stuff attributed to: "Yasser El-Zein" <xa...@hotmail.com>
  
  Revision  Changes    Path
  1.23      +50 -12    xml-xalan/src/org/apache/xalan/xslt/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/Process.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Process.java	2000/07/23 17:06:16	1.22
  +++ Process.java	2000/08/08 02:10:00	1.23
  @@ -151,6 +151,8 @@
      */
     public static void main( String argv[] )
     {
  +    // Exit status stuff attributed to: "Yasser El-Zein" <xa...@hotmail.com>
  +    int exitStatus = 0;
       Runtime.getRuntime().traceMethodCalls(false); // turns tracing off
       boolean doStackDumpOnError = false;
       boolean setQuietMode = false;
  @@ -195,7 +197,8 @@
         catch(Exception e)
         {
           System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_CREATE_XML_PROC_LIAISON, new Object[] {parserLiaisonClassName})); //"Could not create XML Processor Liaison: "+parserLiaisonClassName);
  -        return;
  +        xmlProcessorLiaison = null; // Shut the compiler up
  +        Runtime.getRuntime().exit(-1); 
         }
   
         XSLTProcessor processor = XSLTProcessorFactory.getProcessor(xmlProcessorLiaison);
  @@ -266,19 +269,24 @@
               catch(Exception e)
               {
                 System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_CREATE_TRACELISTENER, new Object[] {className})); //"Could not create TraceListener: "+className);
  +              exitStatus = -1;
               }
             }
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-TCLASS"})); //"Missing argument for);
  -
  +            exitStatus = -1;
  +          }
           }
           else if ("-ESCAPE".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               xmlProcessorLiaison.setSpecialCharacters(argv[++i]);
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-ESCAPE"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if ("-INDENT".equalsIgnoreCase(argv[i]))
           {
  @@ -302,17 +310,23 @@
               catch (SAXException sxe)
               {  
                 diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); 
  -            }  
  +              exitStatus = -1; 
  +           }  
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-IN"})); //"Missing argument for);          
  +            exitStatus = -1; 
  +          }
           }
           else if ("-MEDIA".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               media = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-MEDIA"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
   
           else if ("-OUT".equalsIgnoreCase(argv[i]))
  @@ -320,32 +334,40 @@
             if ( i+1 < argv.length)
               outFileName = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-OUT"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if ("-XSL".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               xslFileName = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-XSL"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if("-LXCIN".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               compiledStylesheetFileNameIn = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-LXCIN"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if("-LXCOUT".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               compiledStylesheetFileNameOut = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-LXCOUT"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if ("-PARAM".equalsIgnoreCase(argv[i]))
           {
  @@ -356,16 +378,20 @@
               processor.setStylesheetParam(name, expression);
             }
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-PARAM"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if ("-treedump".equalsIgnoreCase(argv[i]))
           {
             if ( i+1 < argv.length)
               treedumpFileName = argv[++i];
             else
  +          {
               System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-treedump"})); //"Missing argument for);
  -
  +            exitStatus = -1; 
  +          }
           }
           else if("-F".equalsIgnoreCase(argv[i]))
           {
  @@ -456,8 +482,10 @@
             }
           }
           else
  +        {
             System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_OPTION, new Object[] {argv[i]})); //"Invalid argument:);
  -
  +          exitStatus = -1; 
  +        }
         }
   
         // The main XSL transformation occurs here!
  @@ -580,6 +608,7 @@
         }
         catch(TooManyListenersException tmle)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             tmle.printStackTrace(dumpWriter);
           // else
  @@ -588,6 +617,7 @@
         }
         catch(XPathException xpe)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             xpe.printStackTrace(dumpWriter);
   
  @@ -614,6 +644,7 @@
         }
         catch(SAXException se)
         {
  +        exitStatus = -1; 
           Exception containedException = se.getException();
           if(null != containedException)
           {
  @@ -634,6 +665,7 @@
         }
         catch(MalformedURLException mue)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             mue.printStackTrace(dumpWriter);
           else
  @@ -642,6 +674,7 @@
         }
         catch(ClassNotFoundException cnfe)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             cnfe.printStackTrace(dumpWriter);
           else
  @@ -650,6 +683,7 @@
         }
         catch(FileNotFoundException fne)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             fne.printStackTrace(dumpWriter);
           else
  @@ -658,6 +692,7 @@
         }
         catch(IOException ioe)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             ioe.printStackTrace(dumpWriter);
           else
  @@ -666,6 +701,7 @@
         }
         catch(java.lang.NoClassDefFoundError ncdfe)
         {
  +        exitStatus = -1; 
           String msg = ncdfe.getMessage();
   
           if(msg.indexOf("com/ibm/xml/parser/Parser") >= 0)
  @@ -689,6 +725,7 @@
         }
         catch(RuntimeException rte)
         {
  +        exitStatus = -1; 
           if(doStackDumpOnError)
             rte.printStackTrace(dumpWriter);
           else
  @@ -728,6 +765,7 @@
         else
           diagnosticsWriter.println(""); //"Xalan: done");
       }
  +    Runtime.getRuntime().exit(exitStatus);
     }
     
     /**