You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sh...@locus.apache.org on 2000/03/30 06:28:07 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/resources messages.properties

shemnon     00/03/29 20:28:07

  Modified:    src/share/org/apache/jasper JspC.java
               src/share/org/apache/jasper/resources messages.properties
  Log:
  Bug #54 -- have JspC return an error code on failures
  This is implemented via an optional switch "-die[#]" (like -die5)
  However, I am fairly certian it does not go outside the
  jspc.sh and jspc.bat shells, so you must call the JspC class
  directly to get the die effect.
  PR:54
  
  Revision  Changes    Path
  1.10      +32 -4     jakarta-tomcat/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JspC.java	2000/03/17 07:26:10	1.9
  +++ JspC.java	2000/03/30 04:28:06	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.9 2000/03/17 07:26:10 shemnon Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/03/17 07:26:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.10 2000/03/30 04:28:06 shemnon Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/03/30 04:28:06 $
    *
    * ====================================================================
    * 
  @@ -100,17 +100,21 @@
       public static final String SWITCH_WEBAPP_INC = "-webinc";
       public static final String SWITCH_WEBAPP_XML = "-webxml";
       public static final String SWITCH_MAPPED = "-mapped";
  +    public static final String SWITCH_DIE = "-die";
   
       public static final int NO_WEBXML = 0;
       public static final int INC_WEBXML = 10;
       public static final int ALL_WEBXML = 20;
   
  +    public static final int DEFAULT_DIE_LEVEL = 1;
  +    public static final int NO_DIE_LEVEL = 0;
  +
       // future direction
       //public static final String SWITCH_XML_OUTPUT = "-xml";
     
       
       boolean largeFile = false;
  -	boolean mappedFile = false;
  +    boolean mappedFile = false;
   
       int jspVerbosityLevel = Logger.INFORMATION;
   
  @@ -129,8 +133,13 @@
       String uriRoot;
   
       String webxmlFile;
  +
       int webxmlLevel;
   
  +    int dieLevel;
  +    static int die; // I realize it is duplication, but this is for
  +                    // the static main catch
  +
       //JspLoader loader;
   
       boolean dirset;
  @@ -222,6 +231,8 @@
           String tok;
   
           int verbosityLevel = Logger.WARNING;
  +        dieLevel = NO_DIE_LEVEL;
  +        die = dieLevel;
   
           while ((tok = nextArg()) != null) {
               if (tok.equals(SWITCH_QUIET)) {
  @@ -281,6 +292,14 @@
                   };
               } else if (tok.equals(SWITCH_MAPPED)) {
                   mappedFile = true;
  +            } else if (tok.startsWith(SWITCH_DIE)) {
  +                try {
  +                    dieLevel = Integer.parseInt(
  +                        tok.substring(SWITCH_DIE.length()));
  +                } catch (NumberFormatException nfe) {
  +                    dieLevel = DEFAULT_DIE_LEVEL;
  +                };
  +                die = dieLevel;
               } else {
                   pushBackArg();
                   // Not a recognized Option?  Start treting them as JSP Pages
  @@ -362,10 +381,16 @@
               je.printStackTrace(log);
               log.print("error:");
               log.println(je.getMessage());
  +            if (dieLevel != NO_DIE_LEVEL) {
  +                System.exit(dieLevel);
  +            }
           } catch (Exception e) {
               e.printStackTrace(log);
               log.print("ERROR:");
               log.println(e.toString());
  +            if (dieLevel != NO_DIE_LEVEL) {
  +                System.exit(dieLevel);
  +            }
           };
           return false;
       }
  @@ -577,6 +602,9 @@
               } catch (JasperException je) {
                   System.err.print("error:");
                   System.err.println(je.getMessage());
  +                if (die != NO_DIE_LEVEL) {
  +                    System.exit(die);
  +                }
               }
           }
       };
  
  
  
  1.16      +3 -1      jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- messages.properties	2000/03/28 04:29:49	1.15
  +++ messages.properties	2000/03/30 04:28:06	1.16
  @@ -159,13 +159,15 @@
   \    -p <name>   Name of target package\n\
   \    -c <name>   Name of target class name\n\
   \                (only applies to first JSP page)\n\
  +\    -mapped     Generate separate write() calls for each HTML line in the JSP\n\
  +\    -die[#]     Generate an error return code (#) on fatal errors.\n\
  +\                If the number is absent or unparsable it defaults to 1.\n\
   \    -uribase <dir>  The uri directory compilations shoule be relative to\n\
   \                    (Default is "/")\n\
   \    -uriroot <dir>  The root directory that uri files should be resolved\n\
   \                    against, (Default is the directory jspc is invoked from)\n\
   \    -webinc <file>  Creates partial servlet mapings for the -webapp option\n\
   \    -webxml <file>  Creates a complete web.xml when using the -webapp option.\n\
  -\    -mapped     Generate separate write() calls for each HTML line in the JSP\n\
   \    -ieplugin <clsid>  Java Plugin classid for Internet Explorer\n\
   
   jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>i\n\