/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.chart.script;

/**
 * An adapter class for IScriptClassLoader. It first try to load class from
 * current context, if fail, try to load by parent loader.
 */
public class ScriptClassLoaderAdapter implements IScriptClassLoader
{

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.chart.script.IScriptClassLoader#loadClass(java.lang.String,
	 *      java.lang.ClassLoader)
	 */
	public Class loadClass( String className, ClassLoader parentLoader )
			throws ClassNotFoundException
	{
		try
		{
			return Class.forName( className );
		}
		catch ( ClassNotFoundException ex )
		{
			if ( parentLoader != null )
			{
				return parentLoader.loadClass( className );
			}

			throw ex;
		}
	}
}

@@ -778,16 +778,225 @@
 ader%0A%7B%0A%0A
+%09final private ClassLoader defaultLoader;%0A%0A%09public ScriptClassLoaderAdapter( ClassLoader defaultLoader )%0A%09%7B%0A%09%09this.defaultLoader = defaultLoader;%0A%09%7D%0A%0A%09public ScriptClassLoaderAdapter( )%0A%09%7B%0A%09%09this( null );%0A%09%7D%0A%0A
 %09/*%0A%09 * 
@@ -1022,16 +1022,20 @@
 %09 * @see
+%0A%09 *
  org.ecl
@@ -1100,24 +1100,20 @@
 ang.
+%0A%09 * 
 String,
-%0A%09 *     
  jav
@@ -1150,16 +1150,19 @@
 ic Class
+%3C?%3E
  loadCla
@@ -1263,42 +1263,152 @@
 %0A%09%09%09
-return Class.forName( className );
+if ( defaultLoader == null )%0A%09%09%09%7B%0A%09%09%09%09return Class.forName( className );%0A%09%09%09%7D%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09return defaultLoader.loadClass( className );%0A%09%09%09%7D
 %0A%09%09%7D

Fix #232824 on behalf of Yi Wang.