stevel      2002/10/30 11:40:45

  Modified:    java/webapps/axis happyaxis.jsp
  Log:
  bug 13357  ; handle NoClassDefFound properly.
  
  Revision  Changes    Path
  1.11      +33 -14    xml-axis/java/webapps/axis/happyaxis.jsp
  
  Index: happyaxis.jsp
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/webapps/axis/happyaxis.jsp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- happyaxis.jsp     30 Oct 2002 01:53:12 -0000      1.10
  +++ happyaxis.jsp     30 Oct 2002 19:40:45 -0000      1.11
  @@ -71,6 +71,8 @@
        * but here we want to validate JSP compilation too, and have a drop-in
        * page for easy re-use
        * @author Steve 'configuration problems' Loughran
  +     * @author dims
  +     * @author Brian Ewins
        */
   
   
  @@ -136,28 +138,45 @@
                      String description,
                      String errorText,
                      String homePage) throws IOException {
  -
  -       Class clazz = classExists(classname);
  -       if(clazz == null)  {
  +        try {
  +            Class clazz = classExists(classname);
  +            if(clazz == null)  {
  +               String url="";
  +               if(homePage!=null) {
  +                  url="<br>  See <a href="+homePage+">"+homePage+"</a>";
  +               }
  +               out.write("<p>"+category+": could not find class "+classname
  +                   +" from file <b>"+jarFile
  +                   +"</b><br>  "+errorText
  +                   +url
  +                   +"<p>");
  +               return 1;
  +            } else {
  +               String location = getLocation(out, clazz);
  +               if(location == null) {
  +                  out.write("Found "+ description + " (" + classname + ")<br>");
  +               }
  +               else {
  +                  out.write("Found "+ description + " (" + classname + ") at " + 
location + "<br>");
  +               }
  +               return 0;
  +            }
  +        } catch(NoClassDefFoundError ncdfe) { 
               String url="";
               if(homePage!=null) {
                   url="<br>  See <a href="+homePage+">"+homePage+"</a>";
               }
  -            out.write("<p>"+category+": could not find class "+classname
  +            out.write("<p>"+category+": could not find a dependency"
  +                    +" of class "+classname
                       +" from file <b>"+jarFile
  -                    +"</b><br>  "+errorText
  +                    +"</b><br> "+errorText
                       +url
  +                    +"<br>The root cause was: "+ncdfe.getMessage()
  +                    +"<br>This can happen e.g. if "+classname+" is in" 
  +                    +" the 'common' classpath, but a dependency like "
  +                    +" activation.jar is only in the webapp classpath."
                       +"<p>");
               return 1;
  -        } else {
  -            String location = getLocation(out, clazz);
  -            if(location == null) {
  -                out.write("Found "+ description + " (" + classname + ")<br>");
  -            }
  -            else {
  -                out.write("Found "+ description + " (" + classname + ") at " + 
location + "<br>");
  -            }
  -            return 0;
           }
       }
   
  
  
  


Reply via email to