tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kin...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler Compiler.java
Date Thu, 04 Oct 2001 19:20:08 GMT
kinman      01/10/04 12:20:08

  Modified:    jasper/src/share/org/apache/jasper/compiler Tag:
                        tomcat_40_branch Compiler.java
  Log:
  PR: 2693, 3822
  Catch NumberFormatException when attempting to get the line number from
  javac error messages, so that the messages will be dispalyed if we guess
  wrong.  Also filter the line so that tags in strings are displayed
  correctly.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.2  +32 -21    jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.12.2.1
  retrieving revision 1.12.2.2
  diff -u -r1.12.2.1 -r1.12.2.2
  --- Compiler.java	2001/09/25 00:50:51	1.12.2.1
  +++ Compiler.java	2001/10/04 19:20:08	1.12.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
1.12.2.1 2001/09/25 00:50:51 remm Exp $
  - * $Revision: 1.12.2.1 $
  - * $Date: 2001/09/25 00:50:51 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
1.12.2.2 2001/10/04 19:20:08 kinman Exp $
  + * $Revision: 1.12.2.2 $
  + * $Date: 2001/10/04 19:20:08 $
    *
    * ====================================================================
    * 
  @@ -311,26 +311,37 @@
               int beginColon=line.indexOf(':', 2); // Drive letter on Windows !!
               int endColon=line.indexOf(':', beginColon+1);
   
  -            if (beginColon<0 || endColon<0) {
  -                errorMsg.append(line);
  -                errorMsg.append('\n');
  -                continue;
  -            }
  -
  -            String nr = line.substring(beginColon+1, endColon);
  -            int lineNr = Integer.parseInt( nr );
  -
  -            //System.out.println("lineNr: " + lineNr);
  +            if (!(beginColon<0 || endColon<0 ||
  +			line.startsWith("Note: "))){ // deprecation warning
   
  -            // Now do the mapping
  -            String mapping = findMapping(map, lineNr);
  -            if (mapping == null)
  -                errorMsg.append('\n');
  -            else
  -                errorMsg.append(mapping);
  -            errorMsg.append(line);
  +                try {
  +                    String nr = line.substring(beginColon+1, endColon);
  +                    int lineNr = Integer.parseInt( nr );
  +                    //System.out.println("lineNr: " + lineNr);
  +
  +                    // Now do the mapping
  +                    String mapping = findMapping(map, lineNr);
  +                    if (mapping == null)
  +                        errorMsg.append('\n');
  +                    else
  +                        errorMsg.append(mapping);
  +                }
  +                catch (NumberFormatException ex) {
  +                    // If for some reason our guess at the location of the line
  +                    // number failed, time to give up.
  +                }
  +            }
  +            // Replace '<' in line with "&lt;", ">" with "&gt;" in line
  +            for (int i = 0; i < line.length(); i++) {
  +                char c = line.charAt(i);
  +                if (c == '<')
  +                    errorMsg.append("&lt;");
  +                else if (c == '>')
  +                    errorMsg.append("&gt;");
  +                else
  +                    errorMsg.append(c);
  +            }
               errorMsg.append('\n');
  -
           }
           br.close();
           map.clear();
  
  
  

Mime
View raw message