Title: Message
Stefan,
 
What exactly is the problem?  In order to patch the source, we usually like to write a test case first that exhibits the bug.  Then, we write the fix.  Can you explain to me exactly what the issue is so that I can write a test case?  Or, do you already have a test case?
 
Thanks,
 
James
-----Original Message-----
From: Liebig, Stefan [mailto:[EMAIL PROTECTED]
Sent: Monday, May 02, 2005 6:54 AM
To: [email protected]
Subject: djUnit: HIVEMIND-79

Can someone please have a look at this problem. The author
of djUnit already provided a patch for HM. If his patch
does not cause any other problems, it would be fine to
have it in HM 1.1.
The patch is attached here.
 
Stefan
 
//  Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.service.impl;
import java.util.ArrayList;
import java.util.List;
/**
 * ClassLoader used to properly instantiate newly created classes.
 *
 * @author Howard Lewis Ship / Essl Christian
 * @see org.apache.hivemind.service.impl.CtClassSource
 */
class ClassFactoryClassLoader extends ClassLoader
{
    private List _loaders = new ArrayList();
   
    public ClassFactoryClassLoader() {
     super(Thread.currentThread().getContextClassLoader());
    }
    /**
     * Invoked to create a new class instance from fabricated bytecode.
     */
    public Class loadClass(String name, byte[] bytecodes)
    {
        Class result = defineClass(name, bytecodes, 0, bytecodes.length);
        resolveClass(result);
        return result;
    }
    /**
     * Adds a delegate class loader to the list of delegate class loaders.
     */
    public synchronized void addDelegateLoader(ClassLoader loader)
    {
        _loaders.add(loader);
    }
    /**
     * Searches each of the delegate class loaders for the given class.
     */
    protected synchronized Class findClass(String name) throws ClassNotFoundException
    {
        ClassNotFoundException cnfex = null;
        try
        {
            return super.findClass(name);
        }
        catch (ClassNotFoundException ex)
        {
            cnfex = ex;
        }
        int count = _loaders.size();
        for (int i = 0; i < count; i++)
        {
            ClassLoader l = (ClassLoader) _loaders.get(i);
            try
            {
                return l.loadClass(name);
            }
            catch (ClassNotFoundException ex)
            {
            }
        }
        // Not found .. through the first exception
        throw cnfex;
    }
}

Reply via email to