Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-29 Thread Costin Manolache

Remy Maucherat wrote:

Jan Luehe wrote:

As a reminder, CVS shound't be used anymore.


I commited a bunch of small changes, don't know how easy it'll be to get 
them in after the switch to svn. Let me know if there's a problem, I can 
roll them back.


BTW - I had some of the changes in IntrospectionUtils in my workspace as 
well, so I don't have to commit that :-)


Costin


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-28 Thread Remy Maucherat

[EMAIL PROTECTED] wrote:

  +/*
  + * Clear the IntrospectionUtils cache.
  + *
  + * Implementation note:
  + * Any reference to IntrospectionUtils which may cause the static
  + * initalizer of that class to be invoked must occur prior to setting
  + * the started flag to FALSE, because the static initializer of
  + * IntrospectionUtils makes a call to
  + * org.apache.commons.logging.LogFactory.getLog(), which ultimately
  + * calls the loadClass() method of the thread context classloader,
  + * which is the same as this classloader, whose impl throws a
  + * ThreadDeath if the started flag has been set to FALSE.
  + */
  +IntrospectionUtils.clear();
  +


This commit does not make sense to me. The static initializer is called 
when loading the class, and obviously the webapp CL is not going to load 
IntrospectionUtils.


You should forget that the CVS exists, as we're in the middle of 
migrating to SVN (of course, losing that commit will not be a problem).


Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-28 Thread Jan Luehe
Remy,

Remy Maucherat wrote On 09/28/05 03:12,:
 [EMAIL PROTECTED] wrote:
 
  +/*
  + * Clear the IntrospectionUtils cache.
  + *
  + * Implementation note:
  + * Any reference to IntrospectionUtils which may cause the static
  + * initalizer of that class to be invoked must occur prior to 
 setting
  + * the started flag to FALSE, because the static initializer of
  + * IntrospectionUtils makes a call to
  + * org.apache.commons.logging.LogFactory.getLog(), which ultimately
  + * calls the loadClass() method of the thread context classloader,
  + * which is the same as this classloader, whose impl throws a
  + * ThreadDeath if the started flag has been set to FALSE.
  + */
  +IntrospectionUtils.clear();
  +
 
 
 This commit does not make sense to me. The static initializer is called 
 when loading the class, and obviously the webapp CL is not going to load 
 IntrospectionUtils.

This code in IntrospectionUtils.java:

private static org.apache.commons.logging.Log log=
org.apache.commons.logging.LogFactory.getLog(
IntrospectionUtils.class );

will cause LogFactoryImpl.getLogConstructor() to be called, which
in turn will invoke LogFactoryImpl.loadClass(String name), which is
implemented as follows:

private static Class loadClass( final String name )
throws ClassNotFoundException
{
Object result = AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
ClassLoader threadCL = getContextClassLoader();
if (threadCL != null) {
try {
return threadCL.loadClass(name);
} catch( ClassNotFoundException ex ) {
// ignore
}
}
try {
return Class.forName( name );
} catch (ClassNotFoundException e) {
return e;
}
}
});

if (result instanceof Class)
return (Class)result;

throw (ClassNotFoundException)result;
}

Notice the use of the thread context classloader (to load the class
with the given name), which is the same as the WebappClassLoader.

WebappClassLoader.loadClass() has this:

// Don't load classes if class loader is stopped
if (!started) {
log.info(sm.getString(webappClassLoader.stopped));
throw new ThreadDeath();
}

We have seen the ThreadDeath in our callstacks, hence this fix.

Jan


 You should forget that the CVS exists, as we're in the middle of 
 migrating to SVN (of course, losing that commit will not be a problem).
 
 Rémy
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-28 Thread Remy Maucherat

Jan Luehe wrote:

We have seen the ThreadDeath in our callstacks, hence this fix.


Nobody is reading what I am writing anymore ...

I wrote:
The static initializer is called when loading the class, and obviously 
the webapp CL is not going to load IntrospectionUtils.


IntrospectionUtils will be loaded once, and its static initializer run 
once. So I am ok with your fix, but I don't understand how it can occur 
in regular Tomcat.


The big comment block is quite pointless, as it tries to be 
informational, but doesn't correspond to reality (I am personally 
against this kind of commit message duplication comment).


As a reminder, CVS shound't be used anymore.

Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-28 Thread Jan Luehe
Remy,

Remy Maucherat wrote On 09/28/05 10:18,:
 Jan Luehe wrote:
 
We have seen the ThreadDeath in our callstacks, hence this fix.
 
 
 Nobody is reading what I am writing anymore ...

No, I did.

 I wrote:
 The static initializer is called when loading the class, and obviously 
 the webapp CL is not going to load IntrospectionUtils.
 
 IntrospectionUtils will be loaded once, and its static initializer run 
 once.

Yes, but with lazy resolution, it will be loaded when the
IntrospectionUtils symbol is first encountered, which may
be inside WebappClassLoader.stop().

IntrospectionUtils' static initializer will cause an invocation of
loadClass() on the thread's context classloader, which corresponds to
the WebappClassLoader, whose loadClass() throws ThreadDeath when
its started flag has been set to FALSE.

Therefore, we must avoid referencing IntrospectionUtils in
WebappClassLoader.stop() after the started flag has been
set to FALSE.

 So I am ok with your fix, but I don't understand how it can occur 
 in regular Tomcat.

It's probably not occurring in standalone Tomcat, but only
in embedded Tomcat. In standalone Tomcat, IntrospectionUtils is
probably getting resolved (and its static initializer invoked)
prior to calling WebappClassLoader.stop(),
whereas in embedded mode, IntrospectionUtils is first referenced
and loaded by WebappClassLoader.stop().

 The big comment block is quite pointless, as it tries to be 
 informational, but doesn't correspond to reality (I am personally 
 against this kind of commit message duplication comment).

Sure, I just thought this line might be an easy candidate for
being moved around if there was no comment.

 As a reminder, CVS shound't be used anymore.

Yes.


Jan

 
 Rémy
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-28 Thread Remy Maucherat

Jan Luehe wrote:

No, I did.


Cool, there's one, at least :)


Yes, but with lazy resolution, it will be loaded when the
IntrospectionUtils symbol is first encountered, which may
be inside WebappClassLoader.stop().


Normally, it's used by plenty of things, like the digester. Who knows 
anyway, I find the classloading behavior to be weird sometimes.


So I am ok with your fix, but I don't understand how it can occur 
in regular Tomcat.


It's probably not occurring in standalone Tomcat, but only
in embedded Tomcat. In standalone Tomcat, IntrospectionUtils is
probably getting resolved (and its static initializer invoked)
prior to calling WebappClassLoader.stop(),
whereas in embedded mode, IntrospectionUtils is first referenced
and loaded by WebappClassLoader.stop().

The big comment block is quite pointless, as it tries to be 
informational, but doesn't correspond to reality (I am personally 
against this kind of commit message duplication comment).


Sure, I just thought this line might be an easy candidate for
being moved around if there was no comment.


Stuff won't get moved around for no reason ;)

It would actually be good to move the 3 cleanup calls to 
StandardContext.stop.


Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-09-27 Thread jfarcand
jfarcand2005/09/27 16:42:53

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Port fix from SJSAS.
  
  Patch submitted by: Jan Luehe
  
  Revision  ChangesPath
  1.51  +16 -3 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- WebappClassLoader.java8 Sep 2005 15:00:54 -   1.50
  +++ WebappClassLoader.java27 Sep 2005 23:42:53 -  1.51
  @@ -1470,6 +1470,21 @@
*/
   public void stop() throws LifecycleException {
   
  +/*
  + * Clear the IntrospectionUtils cache.
  + *
  + * Implementation note:
  + * Any reference to IntrospectionUtils which may cause the static
  + * initalizer of that class to be invoked must occur prior to setting
  + * the started flag to FALSE, because the static initializer of
  + * IntrospectionUtils makes a call to
  + * org.apache.commons.logging.LogFactory.getLog(), which ultimately
  + * calls the loadClass() method of the thread context classloader,
  + * which is the same as this classloader, whose impl throws a
  + * ThreadDeath if the started flag has been set to FALSE.
  + */
  +IntrospectionUtils.clear();
  +
   started = false;
   
   int length = files.length;
  @@ -1515,8 +1530,6 @@
   org.apache.commons.logging.LogFactory.release(this);
   // Clear the classloader reference in the VM's bean introspector
   java.beans.Introspector.flushCaches();
  -// Clear the IntrospectionUtils cache
  -IntrospectionUtils.clear();
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-05-04 Thread jfclere
jfclere 2005/05/04 00:30:24

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Allow to use properties in native encoding.
  In EBCDIC Environments the FileInputStream is localized but not the
  ByteArrayInputStream therefore loading a properties from such
  a file using the WebappClassLoader class loader failed.
  
  Revision  ChangesPath
  1.49  +32 -2 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- WebappClassLoader.java30 Mar 2005 13:01:00 -  1.48
  +++ WebappClassLoader.java4 May 2005 07:30:24 -   1.49
  @@ -354,6 +354,11 @@
*/
   protected boolean hasExternalRepositories = false;
   
  +/**
  + * need conversion for properties files
  + */
  +protected boolean needConvert = false;
  +
   
   /**
* All permission.
  @@ -1444,6 +1449,15 @@
   public void start() throws LifecycleException {
   
   started = true;
  +String encoding = null;
  +try {
  +encoding = System.getProperty(file.encoding);
  +} catch (Exception e) {
  +return;
  +}
  +if (encoding.indexOf(EBCDIC)!=-1) {
  +needConvert = true;
  +}
   
   }
   
  @@ -1695,6 +1709,8 @@
   
   Resource resource = null;
   
  +boolean fileNeedConvert = false;
  +
   for (i = 0; (entry == null)  (i  repositoriesLength); i++) {
   try {
   
  @@ -1728,6 +1744,12 @@
   return null;
   }
   
  +if (needConvert) {
  +if (path.endsWith(.properties)) {
  +fileNeedConvert = true;
  +}
  +}
  +
   // Register the full path for modification checking
   // Note: Only syncing on a 'constant' object is needed
   synchronized (allPermission) {
  @@ -1855,8 +1877,8 @@
   
   byte[] binaryContent = new byte[contentLength];
   
  +int pos = 0;
   try {
  -int pos = 0;
   
   while (true) {
   int n = binaryStream.read(binaryContent, pos,
  @@ -1874,6 +1896,14 @@
   return null;
   }
   
  +if (fileNeedConvert) {
  +String str = new String(binaryContent,0,pos);
  +try {
  +binaryContent = str.getBytes(UTF-8);
  +} catch (Exception e) {
  +return null;
  +}
  +}
   entry.binaryContent = binaryContent;
   
   // The certificates are only available after the JarEntry 
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-03-30 Thread remm
remm2005/03/30 05:01:00

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - 33743: Additional syncs, since checking binaryContent== null by itself is 
unreliable.
  
  Revision  ChangesPath
  1.48  +7 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- WebappClassLoader.java21 Mar 2005 15:59:26 -  1.47
  +++ WebappClassLoader.java30 Mar 2005 13:01:00 -  1.48
  @@ -1569,14 +1569,18 @@
   
   entry = findResourceInternal(name, classPath);
   
  -if ((entry == null) || (entry.binaryContent == null
  - entry.loadedClass == null))
  +if (entry == null)
   throw new ClassNotFoundException(name);
   
   Class clazz = entry.loadedClass;
   if (clazz != null)
   return clazz;
   
  +synchronized (this) {
  +if (entry.binaryContent == null  entry.loadedClass == null)
  +throw new ClassNotFoundException(name);
  +}
  +
   // Looking up the package
   String packageName = null;
   int pos = name.lastIndexOf('.');
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-03-21 Thread remm
remm2005/03/21 07:59:26

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - private - protected (as the class is not final).
  
  Revision  ChangesPath
  1.47  +16 -16
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- WebappClassLoader.java25 Jan 2005 13:16:32 -  1.46
  +++ WebappClassLoader.java21 Mar 2005 15:59:26 -  1.47
  @@ -100,14 +100,14 @@
   implements Reloader, Lifecycle
{
   
  -private static org.apache.commons.logging.Log log=
  +protected static org.apache.commons.logging.Log log=
   org.apache.commons.logging.LogFactory.getLog( 
WebappClassLoader.class );
   
   protected class PrivilegedFindResource
   implements PrivilegedAction {
   
  -private File file;
  -private String path;
  +protected File file;
  +protected String path;
   
   PrivilegedFindResource(File file, String path) {
   this.file = file;
  @@ -132,20 +132,20 @@
* but where the corresponding JAR files are required to run on
* earlier versions.
*/
  -private static final String[] triggers = {
  +protected static final String[] triggers = {
   javax.servlet.Servlet // Servlet API
   };
   
   /** 
* Jdk Compatibility Support.
*/
  -private static JdkCompat jdkCompat = JdkCompat.getJdkCompat();
  +protected static JdkCompat jdkCompat = JdkCompat.getJdkCompat();
   
   /**
* Set of package names which are not allowed to be loaded from a webapp
* class loader without delegating first.
*/
  -private static final String[] packageTriggers = {
  +protected static final String[] packageTriggers = {
   };
   
   
  @@ -309,38 +309,38 @@
* A list of read File and Jndi Permission's required if this loader
* is for a web application context.
*/
  -private ArrayList permissionList = new ArrayList();
  +protected ArrayList permissionList = new ArrayList();
   
   
   /**
* Path where resources loaded from JARs will be extracted.
*/
  -private File loaderDir = null;
  +protected File loaderDir = null;
   
   
   /**
* The PermissionCollection for each CodeSource for a web
* application context.
*/
  -private HashMap loaderPC = new HashMap();
  +protected HashMap loaderPC = new HashMap();
   
   
   /**
* Instance of the SecurityManager installed.
*/
  -private SecurityManager securityManager = null;
  +protected SecurityManager securityManager = null;
   
   
   /**
* The parent class loader.
*/
  -private ClassLoader parent = null;
  +protected ClassLoader parent = null;
   
   
   /**
* The system class loader.
*/
  -private ClassLoader system = null;
  +protected ClassLoader system = null;
   
   
   /**
  @@ -358,7 +358,7 @@
   /**
* All permission.
*/
  -private Permission allPermission = new java.security.AllPermission();
  +protected Permission allPermission = new java.security.AllPermission();
   
   
   // - 
Properties
  @@ -1650,7 +1650,7 @@
*
* @return the loaded resource, or null if the resource isn't found
*/
  -private ResourceEntry findResourceInternal(File file, String path){
  +protected ResourceEntry findResourceInternal(File file, String path){
   ResourceEntry entry = new ResourceEntry();
   try {
   entry.source = getURI(new File(file, path));
  @@ -2038,7 +2038,7 @@
*
* @exception IOException if an input/output error occurs
*/
  -private boolean validateJarFile(File jarfile)
  +protected boolean validateJarFile(File jarfile)
   throws IOException {
   
   if (triggers == null)
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2005-01-25 Thread remm
remm2005/01/25 05:16:32

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - 26135: Workaround for memory leak when reloading Struts based web 
applications.
  - Submitted by Tobias Löfstrand.
  - Please let me know if it actually fixes the problem (I didn't test it yet).
  
  Revision  ChangesPath
  1.46  +4 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- WebappClassLoader.java27 Oct 2004 00:07:45 -  1.45
  +++ WebappClassLoader.java25 Jan 2005 13:16:32 -  1.46
  @@ -1496,7 +1496,10 @@
   deleteDir(loaderDir);
   }
   
  +// Clear the classloader reference in common-logging
   org.apache.commons.logging.LogFactory.release(this);
  +// Clear the classloader reference in the VM's bean introspector
  +java.beans.Introspector.flushCaches();
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-10-26 Thread remm
remm2004/10/26 17:07:45

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Fix condition which seems to not have been properly updated after adding 
entry.binaryContent = null a little below.
  - Remove useless sync trick.
  - Submitted by Joe Zhou as bug 31903.
  
  Revision  ChangesPath
  1.45  +17 -20
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- WebappClassLoader.java5 Oct 2004 16:46:15 -   1.44
  +++ WebappClassLoader.java27 Oct 2004 00:07:45 -  1.45
  @@ -1566,7 +1566,8 @@
   
   entry = findResourceInternal(name, classPath);
   
  -if ((entry == null) || (entry.binaryContent == null))
  +if ((entry == null) || (entry.binaryContent == null
  + entry.loadedClass == null))
   throw new ClassNotFoundException(name);
   
   Class clazz = entry.loadedClass;
  @@ -1620,26 +1621,22 @@
   
   }
   
  -if (entry.loadedClass == null) {
  -synchronized (this) {
  -if (entry.loadedClass == null) {
  -clazz = defineClass(name, entry.binaryContent, 0,
  -entry.binaryContent.length, 
  -codeSource);
  -entry.loadedClass = clazz;
  -entry.binaryContent = null;
  -entry.source = null;
  -entry.codeBase = null;
  -entry.manifest = null;
  -entry.certificates = null;
  -} else {
  -clazz = entry.loadedClass;
  -}
  +synchronized (this) {
  +if (entry.loadedClass == null) {
  +clazz = defineClass(name, entry.binaryContent, 0,
  +entry.binaryContent.length, 
  +codeSource);
  +entry.loadedClass = clazz;
  +entry.binaryContent = null;
  +entry.source = null;
  +entry.codeBase = null;
  +entry.manifest = null;
  +entry.certificates = null;
  +} else {
  +clazz = entry.loadedClass;
   }
  -} else {
  -clazz = entry.loadedClass;
   }
  -
  +
   return clazz;
   
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-10-01 Thread remm
remm2004/10/01 02:30:00

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - I think the package triggers are no longer useful (especially on JDK 1.5, where 
everything got package renamed).
  - On JDK 1.4, there won't be any problem if Xerces and Xalan are endorsed (AFAIK, 
they need to be to be able to be used).
  
  Revision  ChangesPath
  1.43  +1 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- WebappClassLoader.java29 Aug 2004 16:46:10 -  1.42
  +++ WebappClassLoader.java1 Oct 2004 09:30:00 -   1.43
  @@ -146,11 +146,6 @@
* class loader without delegating first.
*/
   private static final String[] packageTriggers = {
  -javax, // Java extensions
  -org.xml.sax,   // SAX 1  2
  -org.w3c.dom,   // DOM 1  2
  -org.apache.xerces, // Xerces 1  2
  -org.apache.xalan   // Xalan
   };
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-07-30 Thread remm
remm2004/07/30 02:43:32

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Move the try/catch IOE inside the loop, as suggested in bug 30362.
  
  Revision  ChangesPath
  1.41  +14 -14
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- WebappClassLoader.java26 Jul 2004 15:52:17 -  1.40
  +++ WebappClassLoader.java30 Jul 2004 09:43:32 -  1.41
  @@ -1512,21 +1512,21 @@
*/
   public void closeJARs(boolean force) {
   if (jarFiles.length  0) {
  -try {
   synchronized (jarFiles) {
   if (force || (System.currentTimeMillis() 
  (lastJarAccessed + 9))) {
   for (int i = 0; i  jarFiles.length; i++) {
  -if (jarFiles[i] != null) {
  -jarFiles[i].close();
  -jarFiles[i] = null;
  +try {
  + if (jarFiles[i] != null) {
  + jarFiles[i].close();
  + jarFiles[i] = null;
  + }
  +} catch (IOException e) {
  +log.warn(Failed to close JAR, e);
   }
   }
   }
   }
  -} catch (IOException e) {
  -log.warn(Failed to close JAR, e);
  -}
   }
   }
   
  @@ -1541,12 +1541,12 @@
   if (started  (jarFiles.length  0)) {
   lastJarAccessed = System.currentTimeMillis();
   if (jarFiles[0] == null) {
  -try {
  -for (int i = 0; i  jarFiles.length; i++) {
  -jarFiles[i] = new JarFile(jarRealFiles[i]);
  -}
  -} catch (IOException e) {
  -log.warn(Failed to open JAR, e);
  +for (int i = 0; i  jarFiles.length; i++) {
  + try {
  + jarFiles[i] = new JarFile(jarRealFiles[i]);
  + } catch (IOException e) {
  + log.warn(Failed to open JAR, e);
  + }
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2004-07-26 Thread remm
remm2004/07/26 08:52:17

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  - Update to use a flag for the anti JAR locking code. It isn't as foolproof as the 
other one, since you can't just delete a WAR or expanded
folder to undeploy (on Windows, of course).
  - I think the two flags together will cover all the needs.
  
  Revision  ChangesPath
  1.40  +37 -12
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- WebappClassLoader.java23 Jul 2004 22:40:11 -  1.39
  +++ WebappClassLoader.java26 Jul 2004 15:52:17 -  1.40
  @@ -160,6 +160,13 @@
   protected static final StringManager sm =
   StringManager.getManager(Constants.Package);
   
  +
  +/**
  + * Use anti JAR locking code, which does URL rerouting when accessing
  + * resources.
  + */
  +boolean antiJARLocking = false; 
  +
   
   // --- Constructors
   
  @@ -405,6 +412,22 @@
   
   
   /**
  + * @return Returns the antiJARLocking.
  + */
  +public boolean getAntiJARLocking() {
  +return antiJARLocking;
  +}
  +
  +
  +/**
  + * @param antiJARLocking The antiJARLocking to set.
  + */
  +public void setAntiJARLocking(boolean antiJARLocking) {
  +this.antiJARLocking = antiJARLocking;
  +}
  +
  +
  +/**
* If there is a Java SecurityManager create a read FilePermission
* or JndiPermission for the file directory path.
*
  @@ -1027,17 +1050,19 @@
   if (url != null) {
   // Locating the repository for special handling in the case 
   // of a JAR
  -ResourceEntry entry = (ResourceEntry) resourceEntries.get(name);
  -try {
  -String repository = entry.codeBase.toString();
  -if ((repository.endsWith(.jar)) 
  - (!(name.endsWith(.class {
  -// Copy binary content to the work directory if not present
  -File resourceFile = new File(loaderDir, name);
  -url = resourceFile.toURL();
  +if (antiJARLocking) {
  +ResourceEntry entry = (ResourceEntry) resourceEntries.get(name);
  +try {
  +String repository = entry.codeBase.toString();
  +if ((repository.endsWith(.jar)) 
  + (!(name.endsWith(.class {
  +// Copy binary content to the work directory if not present
  +File resourceFile = new File(loaderDir, name);
  +url = resourceFile.toURL();
  +}
  +} catch (Exception e) {
  +// Ignore
   }
  -} catch (Exception e) {
  -// Ignore
   }
   if (log.isDebugEnabled())
   log.debug(  -- Returning ' + url.toString() + ');
  @@ -1766,7 +1791,7 @@
   }
   
   // Extract resources contained in JAR to the workdir
  -if (!(path.endsWith(.class))) {
  +if (antiJARLocking  !(path.endsWith(.class))) {
   byte[] buf = new byte[1024];
   File resourceFile = new File
   (loaderDir, jarEntry.getName());
  
  
  
  1.31  +3 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- WebappLoader.java 23 Jul 2004 22:40:11 -  1.30
  +++ WebappLoader.java 26 Jul 2004 15:52:17 -  1.31
  @@ -645,6 +645,8 @@
   classLoader = createClassLoader();
   classLoader.setResources(container.getResources());
   classLoader.setDelegate(this.delegate);
  +if (container instanceof StandardContext)
  +classLoader.setAntiJARLocking(((StandardContext) 
container).getAntiJARLocking());
   
   for (int i = 0; i  repositories.length; i++) {
   classLoader.addRepository(repositories[i]);
  
  
  


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2004-07-23 Thread remm
remm2004/07/23 15:40:11

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  - enum - enumeration (JDK 1.5 update).
  
  Revision  ChangesPath
  1.39  +7 -7  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- WebappClassLoader.java3 Jul 2004 19:51:14 -   1.38
  +++ WebappClassLoader.java23 Jul 2004 22:40:11 -  1.39
  @@ -703,10 +703,10 @@
   if (getJarPath() != null) {
   
   try {
  -NamingEnumeration enum = resources.listBindings(getJarPath());
  +NamingEnumeration enumeration = 
resources.listBindings(getJarPath());
   int i = 0;
  -while (enum.hasMoreElements()  (i  length)) {
  -NameClassPair ncPair = (NameClassPair) enum.nextElement();
  +while (enumeration.hasMoreElements()  (i  length)) {
  +NameClassPair ncPair = (NameClassPair) 
enumeration.nextElement();
   String name = ncPair.getName();
   // Ignore non JARs present in the lib folder
   if (!name.endsWith(.jar))
  @@ -719,10 +719,10 @@
   }
   i++;
   }
  -if (enum.hasMoreElements()) {
  -while (enum.hasMoreElements()) {
  +if (enumeration.hasMoreElements()) {
  +while (enumeration.hasMoreElements()) {
   NameClassPair ncPair = 
  -(NameClassPair) enum.nextElement();
  +(NameClassPair) enumeration.nextElement();
   String name = ncPair.getName();
   // Additional non-JAR files are allowed
   if (name.endsWith(.jar)) {
  
  
  
  1.30  +7 -7  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- WebappLoader.java 23 Jun 2004 16:59:41 -  1.29
  +++ WebappLoader.java 23 Jul 2004 22:40:11 -  1.30
  @@ -985,10 +985,10 @@
   
   // Looking up directory /WEB-INF/lib in the context
   try {
  -NamingEnumeration enum = resources.listBindings(libPath);
  -while (enum.hasMoreElements()) {
  +NamingEnumeration enumeration = resources.listBindings(libPath);
  +while (enumeration.hasMoreElements()) {
   
  -Binding binding = (Binding) enum.nextElement();
  +Binding binding = (Binding) enumeration.nextElement();
   String filename = libPath + / + binding.getName();
   if (!filename.endsWith(.jar))
   continue;
  @@ -1137,10 +1137,10 @@
   
   try {
   
  -NamingEnumeration enum = srcDir.list();
  -while (enum.hasMoreElements()) {
  +NamingEnumeration enumeration = srcDir.list();
  +while (enumeration.hasMoreElements()) {
   NameClassPair ncPair =
  -(NameClassPair) enum.nextElement();
  +(NameClassPair) enumeration.nextElement();
   String name = ncPair.getName();
   Object object = srcDir.lookup(name);
   File currentFile = new File(destDir, name);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-07-03 Thread markt
markt   2004/07/03 11:50:10

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Fix bug26375. Fix package sealing test for partially sealed jars.
- Patch provided by Mike Bremford
- Ported from TC4
  
  Revision  ChangesPath
  1.37  +7 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- WebappClassLoader.java25 Jun 2004 23:56:25 -  1.36
  +++ WebappClassLoader.java3 Jul 2004 18:50:10 -   1.37
  @@ -1886,8 +1886,12 @@
*/
   protected boolean isPackageSealed(String name, Manifest man) {
   
  -String path = name + /;
  -Attributes attr = man.getAttributes(path);
  +StringBuffer buf = new StringBuffer(name); 
  +for (int i=0;ibuf.length();i++) { 
  +if (buf.charAt(i)=='.') buf.setCharAt(i,'/'); 
  +} 
  +buf.append('/'); 
  +Attributes attr = man.getAttributes(buf.toString()); 
   String sealed = null;
   if (attr != null) {
   sealed = attr.getValue(Name.SEALED);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-07-03 Thread Bill Barker

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, July 03, 2004 11:50 AM
Subject: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java


===
   RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loa
der/WebappClassLoader.java,v
   retrieving revision 1.36
   retrieving revision 1.37
   diff -u -r1.36 -r1.37
   --- WebappClassLoader.java 25 Jun 2004 23:56:25 - 1.36
   +++ WebappClassLoader.java 3 Jul 2004 18:50:10 - 1.37
   @@ -1886,8 +1886,12 @@
 */
protected boolean isPackageSealed(String name, Manifest man) {

   -String path = name + /;
   -Attributes attr = man.getAttributes(path);
   +StringBuffer buf = new StringBuffer(name);
   +for (int i=0;ibuf.length();i++) {
   +if (buf.charAt(i)=='.') buf.setCharAt(i,'/');
   +}
   +buf.append('/');
   +Attributes attr = man.getAttributes(buf.toString());
String sealed = null;
if (attr != null) {
sealed = attr.getValue(Name.SEALED);



It's not a big deal, but wouldn't it be cleaner to do:
String path = name.replace('.', '/') + /;




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-07-03 Thread Mark Thomas
From: Bill Barker [mailto:[EMAIL PROTECTED] 
 From: [EMAIL PROTECTED]
 
 ===
RCS file:
 /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apach
e/catalina/loa
 der/WebappClassLoader.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- WebappClassLoader.java 25 Jun 2004 23:56:25 - 1.36
+++ WebappClassLoader.java 3 Jul 2004 18:50:10 - 1.37
@@ -1886,8 +1886,12 @@
  */
 protected boolean isPackageSealed(String name, 
 Manifest man) {
 
-String path = name + /;
-Attributes attr = man.getAttributes(path);
+StringBuffer buf = new StringBuffer(name);
+for (int i=0;ibuf.length();i++) {
+if (buf.charAt(i)=='.') buf.setCharAt(i,'/');
+}
+buf.append('/');
+Attributes attr = man.getAttributes(buf.toString());
 String sealed = null;
 if (attr != null) {
 sealed = attr.getValue(Name.SEALED);
 
 It's not a big deal, but wouldn't it be cleaner to do:
 String path = name.replace('.', '/') + /;

Fair point. I'll make the change.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-07-03 Thread markt
markt   2004/07/03 12:51:14

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Improve previous patch - thanks to Bill Barker
  
  Revision  ChangesPath
  1.38  +3 -7  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- WebappClassLoader.java3 Jul 2004 18:50:10 -   1.37
  +++ WebappClassLoader.java3 Jul 2004 19:51:14 -   1.38
  @@ -1886,12 +1886,8 @@
*/
   protected boolean isPackageSealed(String name, Manifest man) {
   
  -StringBuffer buf = new StringBuffer(name); 
  -for (int i=0;ibuf.length();i++) { 
  -if (buf.charAt(i)=='.') buf.setCharAt(i,'/'); 
  -} 
  -buf.append('/'); 
  -Attributes attr = man.getAttributes(buf.toString()); 
  +String path = name.replace('.', '/') + '/';
  +Attributes attr = man.getAttributes(path); 
   String sealed = null;
   if (attr != null) {
   sealed = attr.getValue(Name.SEALED);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2004-05-26 Thread yoavs
yoavs   2004/05/26 08:47:41

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Minor JavaDoc fixes (Bugzilla 28335)
  
  Revision  ChangesPath
  1.34  +3 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- WebappClassLoader.java15 Apr 2004 01:44:09 -  1.33
  +++ WebappClassLoader.java26 May 2004 15:47:40 -  1.34
  @@ -1348,7 +1348,7 @@
* directory (if unpacked),
* the context URL, and jar file resources.
*
  - * @param CodeSource where the code was loaded from
  + * @param codeSource where the code was loaded from
* @return PermissionCollection for CodeSource
*/
   protected PermissionCollection getPermissions(CodeSource codeSource) {
  @@ -2042,7 +2042,7 @@
* Check the specified JAR file, and return codetrue/code if it does
* not contain any of the trigger classes.
*
  - * @param jarFile The JAR file to be checked
  + * @param jarfile The JAR file to be checked
*
* @exception IOException if an input/output error occurs
*/
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-12-19 Thread remm
remm2003/12/19 08:44:13

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Reset the repositories array on certain methos calls.
  - Override addURL to set hasExternalRepositories to true.
  
  Revision  ChangesPath
  1.30  +12 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- WebappClassLoader.java11 Dec 2003 16:41:28 -  1.29
  +++ WebappClassLoader.java19 Dec 2003 16:44:13 -  1.30
  @@ -586,6 +586,7 @@
   URL url = new URL(repository);
   super.addURL(url);
   hasExternalRepositories = true;
  +repositoryURLs = null;
   } catch (MalformedURLException e) {
   throw new IllegalArgumentException(e.toString());
   }
  @@ -848,6 +849,16 @@
   
   
   //  ClassLoader Methods
  +
  +
  + /**
  +  * Add the specified URL to the classloader.
  +  */
  + protected void addURL(URL url) {
  + super.addURL(url);
  + hasExternalRepositories = true;
  + repositoryURLs = null;
  + }
   
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-12-11 Thread jfarcand
jfarcand2003/12/11 08:41:28

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Minor fix. Avoid creating two array.
  
  Revision  ChangesPath
  1.29  +3 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- WebappClassLoader.java10 Dec 2003 23:45:39 -  1.28
  +++ WebappClassLoader.java11 Dec 2003 16:41:28 -  1.29
  @@ -1436,12 +1436,12 @@
   }
   
   repositoryURLs = urls;
  -return repositoryURLs;
   
   } catch (MalformedURLException e) {
   repositoryURLs = new URL[0];
  -return (new URL[0]);
   }
  +
  +return repositoryURLs;
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-12-10 Thread remm
remm2003/12/10 15:45:40

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Cache the result of getURLs. Everything else is cached, but this wasn't.
  
  Revision  ChangesPath
  1.28  +15 -2 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- WebappClassLoader.java29 Nov 2003 09:08:16 -  1.27
  +++ WebappClassLoader.java10 Dec 2003 23:45:39 -  1.28
  @@ -297,6 +297,12 @@
   protected String[] repositories = new String[0];
   
   
  + /**
  +  * Repositories URLs, used to cache the result of getURLs.
  +  */
  + protected URL[] repositoryURLs = null;
  +
  +
   /**
* Repositories translated as path in the work directory (for Jasper
* originally), but which is used to generate fake URLs should getURLs be
  @@ -1405,6 +1411,10 @@
*/
   public URL[] getURLs() {
   
  +if (repositoryURLs != null) {
  +return repositoryURLs;
  +}
  +
   URL[] external = super.getURLs();
   
   int filesLength = files.length;
  @@ -1425,9 +1435,11 @@
   }
   }
   
  -return urls;
  +repositoryURLs = urls;
  +return repositoryURLs;
   
   } catch (MalformedURLException e) {
  +repositoryURLs = new URL[0];
   return (new URL[0]);
   }
   
  @@ -1506,6 +1518,7 @@
   resourceEntries.clear();
   resources = null;
   repositories = null;
  +repositoryURLs = null;
   files = null;
   jarFiles = null;
   jarRealFiles = null;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-11-29 Thread remm
remm2003/11/29 01:08:16

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Fix 25079: Classes are still only in the JAR.
  
  Revision  ChangesPath
  1.27  +3 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- WebappClassLoader.java12 Sep 2003 14:06:21 -  1.26
  +++ WebappClassLoader.java29 Nov 2003 09:08:16 -  1.27
  @@ -1082,7 +1082,8 @@
   ResourceEntry entry = (ResourceEntry) resourceEntries.get(name);
   try {
   String repository = entry.codeBase.toString();
  -if (repository.endsWith(.jar)) {
  +if ((repository.endsWith(.jar)) 
  + (!(name.endsWith(.class {
   // Copy binary content to the work directory if not present
   File resourceFile = new File(loaderDir, name);
   url = resourceFile.toURL();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-09-12 Thread remm
remm2003/09/12 07:06:21

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - ThreadDeath is a more appropriate error in this situation.
  
  Revision  ChangesPath
  1.26  +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- WebappClassLoader.java6 Sep 2003 17:49:31 -   1.25
  +++ WebappClassLoader.java12 Sep 2003 14:06:21 -  1.26
  @@ -1249,7 +1249,7 @@
   // Don't load classes if class loader is stopped
   if (!started) {
   log.info(sm.getString(webappClassLoader.stopped));
  -throw new IncompatibleClassChangeError(name);
  +throw new ThreadDeath();
   }
   
   // (0) Check our previously loaded local class cache
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-09-07 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:

remm2003/09/06 10:49:31

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Modify the bundling of commons-logging to fix (hopefully) the nagging CL issues.
  - The commons-logging-api JAR will now be put in the system classloader.
When using an alternate logging implmentation (ex: log4j) you should put the
wrapper implementation in the same classloader or there will likely be trouble.
  - Ex: When using a Struts 1.1 webapp with log4j, there should be commons-logging.jar
(just the log4j logger is fine as well) next to it.
  - Of course, overriding the log4j API in a webapp is still not possible. It wasn't
before as c-logging was treated as a special case by the classloader (like JAXP).
  - This nasty case now works for me (bug 22701), as well as using log4j with
privileged webapps (with or without SSL).
This patch isn't portable to 4.1.x, because the issue there isn't the 
same (it would is Jasper from 4.1.x used commons-logging, but thankfully 
it does not, so the headache level is lower).

I'm suspecting what causes bug 22701 in TC 4.1.x is that the context 
classloader isn't properly reset in the StandardHostValve (I did that on 
purpose originally, thinking it was useless; maybe not ;-) ).

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-09-06 Thread remm
remm2003/09/06 10:49:31

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Modify the bundling of commons-logging to fix (hopefully) the nagging CL issues.
  - The commons-logging-api JAR will now be put in the system classloader.
When using an alternate logging implmentation (ex: log4j) you should put the
wrapper implementation in the same classloader or there will likely be trouble.
  - Ex: When using a Struts 1.1 webapp with log4j, there should be commons-logging.jar
(just the log4j logger is fine as well) next to it.
  - Of course, overriding the log4j API in a webapp is still not possible. It wasn't
before as c-logging was treated as a special case by the classloader (like JAXP).
  - This nasty case now works for me (bug 22701), as well as using log4j with
privileged webapps (with or without SSL).
  
  Revision  ChangesPath
  1.25  +1 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- WebappClassLoader.java2 Sep 2003 21:22:03 -   1.24
  +++ WebappClassLoader.java6 Sep 2003 17:49:31 -   1.25
  @@ -192,7 +192,6 @@
   javax, // Java extensions
   org.xml.sax,   // SAX 1  2
   org.w3c.dom,   // DOM 1  2
  -org.apache.commons.logging,// Commons logging.
   org.apache.xerces, // Xerces 1  2
   org.apache.xalan   // Xalan
   };
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-09-01 Thread remm
remm2003/09/01 14:11:21

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Revert my patch. It works well with log4j, but not with the JDK 1.4 logger.
  
  Revision  ChangesPath
  1.23  +2 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- WebappClassLoader.java1 Sep 2003 20:31:29 -   1.22
  +++ WebappClassLoader.java1 Sep 2003 21:11:21 -   1.23
  @@ -201,6 +201,7 @@
   javax, // Java extensions
   org.xml.sax,   // SAX 1  2
   org.w3c.dom,   // DOM 1  2
  +org.apache.commons.logging,// Commons logging.
   org.apache.xerces, // Xerces 1  2
   org.apache.xalan   // Xalan
   };
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-09-01 Thread remm
remm2003/09/01 13:31:29

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Things have changed in commons-logging, and we must never delegate.
The logger (ex: log4j) must reside either in the same CL as commons-logging,
or in one of its parents.
  
  Revision  ChangesPath
  1.22  +1 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- WebappClassLoader.java31 Aug 2003 14:43:46 -  1.21
  +++ WebappClassLoader.java1 Sep 2003 20:31:29 -   1.22
  @@ -202,7 +202,6 @@
   org.xml.sax,   // SAX 1  2
   org.w3c.dom,   // DOM 1  2
   org.apache.xerces, // Xerces 1  2
  -org.apache.commons.logging,// Commons logging.
   org.apache.xalan   // Xalan
   };
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-08-31 Thread remm
remm2003/08/31 07:43:46

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Null out the reference to the resources.
  
  Revision  ChangesPath
  1.21  +2 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WebappClassLoader.java29 Aug 2003 23:05:50 -  1.20
  +++ WebappClassLoader.java31 Aug 2003 14:43:46 -  1.21
  @@ -1513,6 +1513,7 @@
   
   notFoundResources.clear();
   resourceEntries.clear();
  +resources = null;
   repositories = null;
   files = null;
   jarFiles = null;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-08-30 Thread remm
remm2003/08/29 16:05:50

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Release all logs associated with this CL when stopping the CL.
  - Avoid NPE in toString after stop.
  
  Revision  ChangesPath
  1.20  +10 -5 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WebappClassLoader.java17 Aug 2003 08:36:14 -  1.19
  +++ WebappClassLoader.java29 Aug 2003 23:05:50 -  1.20
  @@ -834,10 +834,12 @@
   sb.append(delegate);
   sb.append(\r\n);
   sb.append(  repositories:\r\n);
  -for (int i = 0; i  repositories.length; i++) {
  -sb.append();
  -sb.append(repositories[i]);
  -sb.append(\r\n);
  +if (repositories != null) {
  +for (int i = 0; i  repositories.length; i++) {
  +sb.append();
  +sb.append(repositories[i]);
  +sb.append(\r\n);
  +}
   }
   if (this.parent != null) {
   sb.append(-- Parent Classloader:\r\n);
  @@ -1520,6 +1522,7 @@
   lastModifiedDates = null;
   paths = null;
   hasExternalRepositories = false;
  +parent = null;
   
   permissionList.clear();
   loaderPC.clear();
  @@ -1527,6 +1530,8 @@
   if (loaderDir != null) {
   deleteDir(loaderDir);
   }
  +
  +org.apache.commons.logging.LogFactory.release(this);
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-08-08 Thread remm
remm2003/08/06 01:58:19

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Fix problems with the Eclipse test case by extracting all non class resources
from a JAR on access.
  - This of course has a performance penalty, but is the only way to have
this use case work. It is not very valid, but I gave up trying to get people to
change their code.
  - This is needed, because it is the only way to save valuable server resources
(file descriptors and memory on Unix, plus JAR locking on Windows preventing
webapp management without a Tomcat restart).
  
  Revision  ChangesPath
  1.18  +82 -15
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WebappClassLoader.java15 Jun 2003 07:22:16 -  1.17
  +++ WebappClassLoader.java6 Aug 2003 08:58:19 -   1.18
  @@ -1079,29 +1079,15 @@
   // Locating the repository for special handling in the case 
   // of a JAR
   ResourceEntry entry = (ResourceEntry) resourceEntries.get(name);
  -FileOutputStream os = null;
   try {
   String repository = entry.codeBase.toString();
   if (repository.endsWith(.jar)) {
   // Copy binary content to the work directory if not present
   File resourceFile = new File(loaderDir, name);
  -if (entry.lastModified  resourceFile.lastModified()) {
  -resourceFile.getParentFile().mkdirs();
  -os = new FileOutputStream(resourceFile);
  -os.write(entry.binaryContent);
  -}
   url = resourceFile.toURL();
   }
   } catch (Exception e) {
   // Ignore
  -e.printStackTrace();
  -} finally {
  -if (os != null) {
  -try {
  -os.close();
  -} catch (IOException ex) {
  -}
  -}
   }
   if (log.isDebugEnabled())
   log.debug(  -- Returning ' + url.toString() + ');
  @@ -1529,6 +1515,10 @@
   permissionList.clear();
   loaderPC.clear();
   
  +if (loaderDir != null) {
  +deleteDir(loaderDir);
  +}
  +
   }
   
   
  @@ -1815,6 +1805,58 @@
   } catch (IOException e) {
   return null;
   }
  +
  +// Extract resources contained in JAR to the workdir
  +if (!(path.endsWith(.class))) {
  +byte[] buf = new byte[1024];
  +File resourceFile = new File
  +(loaderDir, jarEntry.getName());
  +if (!resourceFile.exists()) {
  +Enumeration entries = jarFiles[i].entries();
  +while (entries.hasMoreElements()) {
  +JarEntry jarEntry2 = 
  +(JarEntry) entries.nextElement();
  +if (!(jarEntry2.isDirectory()) 
  + (!jarEntry2.getName().endsWith
  +(.class))) {
  +resourceFile = new File
  +(loaderDir, jarEntry2.getName());
  +resourceFile.getParentFile().mkdirs();
  +FileOutputStream os = null;
  +InputStream is = null;
  +try {
  +is = jarFiles[i].getInputStream
  +(jarEntry2);
  +os = new FileOutputStream
  +(resourceFile);
  +while (true) {
  +int n = is.read(buf);
  +if (n = 0) {
  +break;
  +}
  +os.write(buf, 0, n);
  +}
  +} catch (IOException e) {
  +// Ignore
  + 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2003-06-15 Thread remm
remm2003/06/15 00:22:16

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  - Add a machanism to release JAR objects periodically.
  - This should decrease classloading performance because of a big sync block
during JAR access, but lookup of previously loaded class will behave the same as 
before.
  - Add a workaround for JAR locking with XML processing and getResource.
If the resource was loaded from a JAR, it will be extracted as needed to the
work directory.
  
  Revision  ChangesPath
  1.17  +163 -59   
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- WebappClassLoader.java12 Jun 2003 22:02:12 -  1.16
  +++ WebappClassLoader.java15 Jun 2003 07:22:16 -  1.17
  @@ -61,6 +61,7 @@
   package org.apache.catalina.loader;
   
   import java.io.File;
  +import java.io.FileOutputStream;
   import java.io.FilePermission;
   import java.io.InputStream;
   import java.io.ByteArrayInputStream;
  @@ -285,6 +286,12 @@
   
   
   /**
  + * Last time a JAR was accessed.
  + */
  +protected long lastJarAccessed = 0L;
  +
  +
  +/**
* The list of local repositories, in the order they should be searched
* for locally loaded classes or resources.
*/
  @@ -348,6 +355,12 @@
   
   
   /**
  + * Path where resources loaded from JARs will be extracted.
  + */
  +private File loaderDir = null;
  +
  +
  +/**
* The PermissionCollection for each CodeSource for a web
* application context.
*/
  @@ -534,6 +547,14 @@
   }
   
   
  +/**
  + * Change the work directory.
  + */
  +public void setWorkDir(File workDir) {
  +this.loaderDir = new File(workDir, loader);
  +}
  +
  +
   // --- Reloader Methods
   
   
  @@ -977,15 +998,18 @@
   }
   
   // Looking at the JAR files
  -for (i = 0; i  jarFilesLength; i++) {
  -JarEntry jarEntry = jarFiles[i].getJarEntry(name);
  -if (jarEntry != null) {
  -try {
  -String jarFakeUrl = getURI(jarRealFiles[i]).toString();
  -jarFakeUrl = jar: + jarFakeUrl + !/ + name;
  -result.addElement(new URL(jarFakeUrl));
  -} catch (MalformedURLException e) {
  -// Ignore
  +synchronized (jarFiles) {
  +openJARs();
  +for (i = 0; i  jarFilesLength; i++) {
  +JarEntry jarEntry = jarFiles[i].getJarEntry(name);
  +if (jarEntry != null) {
  +try {
  +String jarFakeUrl = getURI(jarRealFiles[i]).toString();
  +jarFakeUrl = jar: + jarFakeUrl + !/ + name;
  +result.addElement(new URL(jarFakeUrl));
  +} catch (MalformedURLException e) {
  +// Ignore
  +}
   }
   }
   }
  @@ -1052,6 +1076,33 @@
   // (2) Search local repositories
   url = findResource(name);
   if (url != null) {
  +// Locating the repository for special handling in the case 
  +// of a JAR
  +ResourceEntry entry = (ResourceEntry) resourceEntries.get(name);
  +FileOutputStream os = null;
  +try {
  +String repository = entry.codeBase.toString();
  +if (repository.endsWith(.jar)) {
  +// Copy binary content to the work directory if not present
  +File resourceFile = new File(loaderDir, name);
  +if (entry.lastModified  resourceFile.lastModified()) {
  +resourceFile.getParentFile().mkdirs();
  +os = new FileOutputStream(resourceFile);
  +os.write(entry.binaryContent);
  +}
  +url = resourceFile.toURL();
  +}
  +} catch (Exception e) {
  +// Ignore
  +e.printStackTrace();
  +} finally {
  +if (os != null) {
  +try {
  +os.close();
  +} catch (IOException ex) {
  +}
  +}
  +}
   if (log.isDebugEnabled())
   log.debug(  -- Returning ' + url.toString() + ');
   return (url);
  

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-06-12 Thread remm
remm2003/06/12 15:02:12

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Null out all fields after finishing loading a class.
  
  Revision  ChangesPath
  1.16  +6 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WebappClassLoader.java8 Mar 2003 17:01:20 -   1.15
  +++ WebappClassLoader.java12 Jun 2003 22:02:12 -  1.16
  @@ -1561,6 +1561,11 @@
   entry.binaryContent.length, 
   codeSource);
   entry.loadedClass = clazz;
  +entry.binaryContent = null;
  +entry.source = null;
  +entry.codeBase = null;
  +entry.manifest = null;
  +entry.certificates = null;
   } else {
   clazz = entry.loadedClass;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java

2003-03-08 Thread glenn
glenn   2003/03/08 09:01:20

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java WebappLoader.java
  Log:
  Port bug #17775 patch from Tomcat 4
  
  Revision  ChangesPath
  1.15  +19 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WebappClassLoader.java4 Feb 2003 07:24:22 -   1.14
  +++ WebappClassLoader.java8 Mar 2003 17:01:20 -   1.15
  @@ -464,14 +464,27 @@
* @param path file directory path
*/
   public void addPermission(String path) {
  +if (path == null) {
  +return;
  +}
  +
   if (securityManager != null) {
   Permission permission = null;
   if( path.startsWith(jndi:) || path.startsWith(jar:jndi:) ) {
  +if (!path.endsWith(/)) {
  +path = path + /;
  +}
   permission = new JndiPermission(path + *);
  +addPermission(permission);
   } else {
  -permission = new FilePermission(path + -,read);
  +if (!path.endsWith(File.separator)) {
  +permission = new FilePermission(path, read);
  +addPermission(permission);
  +path = path + File.separator;
  +}
  +permission = new FilePermission(path + -, read);
  +addPermission(permission);
   }
  -addPermission(permission);
   }
   }
   
  @@ -483,7 +496,9 @@
* @param url URL for a file or directory on local system
*/
   public void addPermission(URL url) {
  -addPermission(url.toString());
  +if (url != null) {
  +addPermission(url.toString());
  +}
   }
   
   
  
  
  
  1.8   +15 -28
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebappLoader.java 26 Feb 2003 20:20:39 -  1.7
  +++ WebappLoader.java 8 Mar 2003 17:01:20 -   1.8
  @@ -898,37 +898,28 @@
   String contextRoot = servletContext.getRealPath(/);
   if (contextRoot != null) {
   try {
  -contextRoot = 
  -(new File(contextRoot)).getCanonicalPath() 
  -+ File.separator;
  +contextRoot = (new File(contextRoot)).getCanonicalPath();
   classLoader.addPermission(contextRoot);
   } catch (IOException e) {
   // Ignore
   }
   }
   
  -URL classesURL =
  -servletContext.getResource(/WEB-INF/classes/);
  -if (classesURL != null)
  -classLoader.addPermission(classesURL);
  -
  +URL classesURL = servletContext.getResource(/WEB-INF/classes/);
  +classLoader.addPermission(classesURL);
   URL libURL = servletContext.getResource(/WEB-INF/lib/);
  -if (libURL != null) {
  -classLoader.addPermission(libURL);
  -}
  +classLoader.addPermission(libURL);
   
   if (contextRoot != null) {
   
   if (libURL != null) {
   File rootDir = new File(contextRoot);
   File libDir = new File(rootDir, WEB-INF/lib/);
  -String path = null;
   try {
  -path = libDir.getCanonicalPath() + File.separator;
  +String path = libDir.getCanonicalPath();
  +classLoader.addPermission(path);
   } catch (IOException e) {
   }
  -if (path != null)
  -classLoader.addPermission(path);
   }
   
   } else {
  @@ -936,23 +927,19 @@
   if (workDir != null) {
   if (libURL != null) {
   File libDir = new File(workDir, WEB-INF/lib/);
  -String path = null;
   try {
  -path = libDir.getCanonicalPath() + File.separator;
  +String path = 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-02-03 Thread billbarker
billbarker2003/02/03 23:24:22

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Finally regain the ability to build under 1.3.x
  
  Submitted By: Tim Funk [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.14  +7 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WebappClassLoader.java13 Nov 2002 00:36:25 -  1.13
  +++ WebappClassLoader.java4 Feb 2003 07:24:22 -   1.14
  @@ -97,6 +97,7 @@
   import javax.naming.NamingEnumeration;
   import javax.naming.NameClassPair;
   
  +import org.apache.tomcat.util.compat.JdkCompat;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
  @@ -184,6 +185,10 @@
   javax.servlet.Servlet // Servlet API
   };
   
  + /** 
  +  * Jdk Compatibility Support.
  +  */
  + private static JdkCompat jdkCompat = JdkCompat.getJdkCompat();
   
   /**
* Set of package names which are not allowed to be loaded from a webapp
  @@ -1948,13 +1953,7 @@
   protected URL getURI(File file)
   throws MalformedURLException {
   
  -File realFile = file;
  -try {
  -realFile = realFile.getCanonicalFile();
  -} catch (IOException e) {
  -// Ignore
  -}
  -return realFile.toURI().toURL();
  +return jdkCompat.getURI(file);
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2003-02-03 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 03, 2003 11:24 PM
Subject: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java


 billbarker2003/02/03 23:24:22

   Modified:catalina/src/share/org/apache/catalina/loader
 WebappClassLoader.java
   Log:
   Finally regain the ability to build under 1.3.x

   Submitted By: Tim Funk [EMAIL PROTECTED]

Sorry for the typo:  It should be [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2002-11-12 Thread costin
costin  2002/11/12 16:36:25

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  Added commons logging to the list of delegated jars.
  This prevent some nasty class cast errors. ( that doesn't mean
  apps can't use their own logging impl ).
  
  Switch to c-l in the messages - that allows easier debugging of
  loading problems ( I know it is possible to add the Loader to
  Context, but using the single config file is much simpler ).
  
  Revision  ChangesPath
  1.13  +111 -113  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- WebappClassLoader.java7 Nov 2002 18:03:10 -   1.12
  +++ WebappClassLoader.java13 Nov 2002 00:36:25 -  1.13
   -1,8 +1,4 
   /*
  - * $Header$
  - * $Revision$
  - * $Date$
  - *
* 
*
* The Apache Software License, Version 1.1
   -149,7 +145,11 
*/
   public class WebappClassLoader
   extends URLClassLoader
  -implements Reloader, Lifecycle {
  +implements Reloader, Lifecycle
  + {
  +
  +private static org.apache.commons.logging.Log log=
  +org.apache.commons.logging.LogFactory.getLog( WebappClassLoader.class );
   
   protected class PrivilegedFindResource
   implements PrivilegedAction {
   -194,6 +194,7 
   org.xml.sax,   // SAX 1  2
   org.w3c.dom,   // DOM 1  2
   org.apache.xerces, // Xerces 1  2
  +org.apache.commons.logging,// Commons logging.
   org.apache.xalan   // Xalan
   };
   
   -226,14 +227,15 
   public WebappClassLoader(ClassLoader parent) {
   
   super(new URL[0], parent);
  +
   this.parent = getParent();
  +
   system = getSystemClassLoader();
   securityManager = System.getSecurityManager();
   
   if (securityManager != null) {
   refreshPolicy();
   }
  -
   }
   
   
   -563,8 +565,8 
   if (repository == null)
   return;
   
  -if (debug = 1)
  -log(addRepository( + repository + ));
  +if (log.isDebugEnabled())
  +log.debug(addRepository( + repository + ));
   
   int i;
   
   -597,8 +599,8 
   if (file == null)
   return;
   
  -if (debug = 1)
  -log(addJar( + jar + ));
  +if (log.isDebugEnabled())
  +log.debug(addJar( + jar + ));
   
   int i;
   
   -684,8 +686,8 
*/
   public boolean modified() {
   
  -if (debug = 2)
  -log(modified());
  +if (log.isDebugEnabled())
  +log.debug(modified());
   
   // Checking for modified loaded resources
   int length = paths.length;
   -703,14 +705,15 
   ((ResourceAttributes) resources.getAttributes(paths[i]))
   .getLastModified();
   if (lastModified != lastModifiedDates[i]) {
  -log(  Resource ' + paths[i]
  -+ ' was modified; Date is now: 
  -+ new java.util.Date(lastModified) +  Was: 
  -+ new java.util.Date(lastModifiedDates[i]));
  +if( log.isDebugEnabled() ) 
  +log.debug(  Resource ' + paths[i]
  +  + ' was modified; Date is now: 
  +  + new java.util.Date(lastModified) +  Was: 
  +  + new java.util.Date(lastModifiedDates[i]));
   return (true);
   }
   } catch (NamingException e) {
  -log(Resource ' + paths[i] + ' is missing);
  +log.error(Resource ' + paths[i] + ' is missing);
   return (true);
   }
   }
   -731,8 +734,8 
   continue;
   if (!name.equals(jarNames[i])) {
   // Missing JAR
  -log(Additional JARs have been added : ' 
  -+ name + ');
  +log.info(Additional JARs have been added : ' 
  + + name + ');
   return (true);
   }
   i++;
   -745,22 +748,22 
   // Additional non-JAR files are allowed
   

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2002-11-07 Thread remm
remm2002/11/07 09:24:37

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Experimental change: add getURI method to properly encode codebase URLs.
  
  Revision  ChangesPath
  1.11  +25 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WebappClassLoader.java16 Oct 2002 16:08:29 -  1.10
  +++ WebappClassLoader.java7 Nov 2002 17:24:37 -   1.11
   -945,7 +945,7 
   // Note : Not getting an exception here means the resource was
   // found
   try {
  -result.addElement(getURL(new File(files[i], name)));
  +result.addElement(getURI(new File(files[i], name)));
   } catch (MalformedURLException e) {
   // Ignore
   }
   -958,7 +958,7 
   JarEntry jarEntry = jarFiles[i].getJarEntry(name);
   if (jarEntry != null) {
   try {
  -String jarFakeUrl = getURL(jarRealFiles[i]).toString();
  +String jarFakeUrl = getURI(jarRealFiles[i]).toString();
   jarFakeUrl = jar: + jarFakeUrl + !/ + name;
   result.addElement(new URL(jarFakeUrl));
   } catch (MalformedURLException e) {
   -1563,7 +1563,7 
   private ResourceEntry findResourceInternal(File file, String path){
   ResourceEntry entry = new ResourceEntry();
   try {
  -entry.source = getURL(new File(file, path));
  +entry.source = getURI(new File(file, path));
   entry.codeBase = entry.source;
   } catch (MalformedURLException e) {
   return null;
   -1676,7 +1676,7 
   
   entry = new ResourceEntry();
   try {
  -entry.codeBase = getURL(jarRealFiles[i]);
  +entry.codeBase = getURI(jarRealFiles[i]);
   String jarFakeUrl = entry.codeBase.toString();
   jarFakeUrl = jar: + jarFakeUrl + !/ + path;
   entry.source = new URL(jarFakeUrl);
   -1939,6 +1939,23 
   // Ignore
   }
   return realFile.toURL();
  +
  +}
  +
  +
  +/**
  + * Get URL.
  + */
  +protected URL getURI(File file)
  +throws MalformedURLException {
  +
  +File realFile = file;
  +try {
  +realFile = realFile.getCanonicalFile();
  +} catch (IOException e) {
  +// Ignore
  +}
  +return realFile.toURI().toURL();
   
   }
   
  
  
  

--
To unsubscribe, e-mail:   mailto:tomcat-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2002-11-07 Thread remm
remm2002/11/07 10:03:10

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - codeBase is a URL (unencoded).
  - source is a URI (encoded).
  
  Revision  ChangesPath
  1.12  +8 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebappClassLoader.java7 Nov 2002 17:24:37 -   1.11
  +++ WebappClassLoader.java7 Nov 2002 18:03:10 -   1.12
   -1564,7 +1564,7 
   ResourceEntry entry = new ResourceEntry();
   try {
   entry.source = getURI(new File(file, path));
  -entry.codeBase = entry.source;
  +entry.codeBase = getURL(new File(file, path));
   } catch (MalformedURLException e) {
   return null;
   }   
   -1618,7 +1618,7 
   new PrivilegedFindResource(files[i], path);
   entry = (ResourceEntry)AccessController.doPrivileged(dp);
} else {
  -entry = findResourceInternal(files[i], path);   
  
  +entry = findResourceInternal(files[i], path);
}
   
   ResourceAttributes attributes =
   -1676,8 +1676,8 
   
   entry = new ResourceEntry();
   try {
  -entry.codeBase = getURI(jarRealFiles[i]);
  -String jarFakeUrl = entry.codeBase.toString();
  +entry.codeBase = getURL(jarRealFiles[i]);
  +String jarFakeUrl = getURI(jarRealFiles[i]).toString();
   jarFakeUrl = jar: + jarFakeUrl + !/ + path;
   entry.source = new URL(jarFakeUrl);
   } catch (MalformedURLException e) {
  
  
  

--
To unsubscribe, e-mail:   mailto:tomcat-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2002-10-10 Thread remm

remm2002/10/10 07:35:22

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Throw an error if trying to use a stopped classloader.
  
  Revision  ChangesPath
  1.7   +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebappClassLoader.java5 Sep 2002 11:38:59 -   1.6
  +++ WebappClassLoader.java10 Oct 2002 14:35:21 -  1.7
  @@ -1195,7 +1195,7 @@
   // Don't load classes if class loader is stopped
   if (!started) {
   log(Lifecycle error : CL stopped);
  -throw new ClassNotFoundException(name);
  +throw new IncompatibleClassChangeError(name);
   }
   
   // (0) Check our previously loaded local class cache
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

2002-09-05 Thread remm

remm2002/09/05 04:38:59

  Modified:catalina/src/share/org/apache/catalina/loader
WebappClassLoader.java
  Log:
  - Port patch.
  - Fix bug where external repositories were not used.
Patch submitted by David Oxley dave at staffplanner.co.uk
  - getURL returned invalid URLs. Unfortunately, fixing this will break the security
manager under Windows using the default policy file. The workaround is easy,
as the entries should be modified from:
 grant codeBase file:${catalina.home}/server/webapps/admin/WEB-INF/lib/struts.jar
to
 grant codeBasefile:/${catalina.home}/server/webapps/admin/WEB-INF/lib/struts.jar
(note the extra '/')
  - It will be mentioned in the release notes.
  
  Revision  ChangesPath
  1.6   +9 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebappClassLoader.java24 Aug 2002 02:27:27 -  1.5
  +++ WebappClassLoader.java5 Sep 2002 11:38:59 -   1.6
  @@ -835,6 +835,10 @@
   log(  findClassInternal( + name + ));
   try {
   clazz = findClassInternal(name);
  +} catch(ClassNotFoundException cnfe) {
  +if (!hasExternalRepositories) {
  +throw cnfe;
  +}
   } catch(AccessControlException ace) {
   ace.printStackTrace();
   throw new ClassNotFoundException(name);
  @@ -1923,7 +1927,7 @@
   } catch (IOException e) {
   // Ignore
   }
  -return new URL(file: + realFile.getPath());
  +return realFile.toURL();
   
   }
   
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]