tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@m64.com>
Subject [PATCH] fix VM crashes when loading classes from a persistent workdir
Date Tue, 28 Dec 1999 15:08:48 GMT
Hi,

I tracked down the errors causing the problems when
isWorkDirPersistent="true". I was also able to reproduce the error on my
RedHat 6.0 Linux system using a variety of VMs.

The error is caused when the class name is not set in the JSPEngineContext.
The call to the classLoader's findLoadedClass method was being passed null.
The fact that this causes a SIGSEGV/Access violation with newer VMs is not a
good thing.

The reason the class name being passed is null comes from two problems.
Firstly in org.apache.jasper.compiler.Compiler, the compile method will
return if the class file is not outdated before setting the class' name from
the mangler. Secondly the mangler, org.apache.jasper.compiler.JspCompiler,
is not setting the class name if the class file was not outdated.

The following patches just move code around to ensure the class name is set
even when the class file is not outdated. There is also a patch for a
cosmetic error.

Index: src/share/org/apache/jasper/compiler/Compiler.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler
.java,v
retrieving revision 1.4
diff -r1.4 Compiler.java
101,103d100
<         if (!isOutDated())
<             return false;
<
107a105,108
>
>         ctxt.setServletClassName(className);
>         ctxt.setServletPackageName(pkgName);
>         ctxt.setServletJavaFileName(javaFileName);
121a123,126
>         if (!isOutDated())
>             return false;
>
>
132,134d136
<         ctxt.setServletClassName(className);
<         ctxt.setServletPackageName(pkgName);
<         ctxt.setServletJavaFileName(javaFileName);
Index: src/share/org/apache/jasper/compiler/JspCompiler.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspCompi
ler.java,v
retrieving revision 1.3
diff -r1.3 JspCompiler.java
275d274
<                 String classNameFromFile =
ClassName.getClassName(classFileName);
279,285d277
<                 String cn = cfd.getClassName();
<                 int lastDot = cn.lastIndexOf('.');
<                 if (lastDot != -1)
<                     className = cn.substring(lastDot+1,
<                                              classNameFromFile.length());
<                 else
<                     className = cn;
287,289d278
<               // cn ( Class Name ) is extracted from class data.
<               // If the file is not out-dated, it is not needed, and will
<               // be computed only if someone ask for it.
291a281,288
>             String classNameFromFile =
ClassName.getClassName(classFileName);
>             String cn = cfd.getClassName();
>             int lastDot = cn.lastIndexOf('.');
>             if (lastDot != -1)
>                 className = cn.substring(lastDot+1,
>                                          classNameFromFile.length());
>             else
>                 className = cn;
Index: src/share/org/apache/jasper/runtime/JspServlet.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspServle
t.java,v
retrieving revision 1.11
diff -r1.11 JspServlet.java
127c127
<                 accordingto = "according to the init parameter is";
---
>                 accordingto = "according to the init parameter";
130c130
<                 accordingto = "according to the Servlet Engine is";
---
>                 accordingto = "according to the Servlet Engine";
--
Conor MacNeill
conor@m64.com
M64 Pty Limited


Mime
View raw message