Bug 212110 [regression]Duplicate context parameter definition for birt web project[0603]
Description: Duplicate BIRT_VIEWER_WORKING_FOLDER in web.xml for birt web project Build number:2.3.0.v20071206 Steps to reproduce: 1. New a BIRT web project. 2. Check web.xml Expected result: Each variable in web.xml has only one definition. Actual result: Two definition for the same variable BIRT_VIEWER_WORKING_FOLDER Error log: SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:930) at org.apache.tomcat.util.digester.CallMethodRule.end(CallMethodRule.java:579) at org.apache.tomcat.util.digester.Rule.end(Rule.java:229) at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1058) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endNamespaceScope(XMLDTDValidator.java:2108) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2059) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562) at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:352) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1044) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: java.lang.IllegalArgumentException: Duplicate context initialization parameter BIRT_VIEWER_WORKING_FOLDER at org.apache.catalina.core.StandardContext.addParameter(StandardContext.java:2245) ... 37 more
viewer/org.eclipse.birt.integration.wtp.ui/src/org/eclipse/birt/integration/wtp/ui/internal/util/WebArtifactUtil.java
if ( obj != null )
					continue;
				
				Listener listener = CommonFactory.eINSTANCE.createListener( );
				listener.setListenerClassName( className );
				if ( description != null )
					listener.setDescription( description );
				webapp.getListeners( ).remove( listener );
				webapp.getListeners( ).add( listener );
			}
			webEdit.saveIfNecessary( monitor );
		}
		finally
		{
			webEdit.dispose( );
		}
	}
	/**
	 * get listener from list by class name
	 * 
	 * @param list
	 * @param name
	 * @return
	 */
	public static Object getListenerByClassName( List list, String className )
	{
		if ( list == null || className == null )
			return null;
		Iterator it = list.iterator( );
		while ( it.hasNext( ) )