// Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
// 
//     /**
//      * Adds a factory to the container using the given name.
//      * @param name A name to identify the factory by.
//      * @param factory A factory producing some component.
//      */
//     public void addFactory(String name, IGlobalFactory factory);
// 
//     /**
//      * Adds a value factory to the container using the given name.
//      * A value factory just returns the value passed in the value parameter.
//      * Thus the value object becomes a singleton.
//      * Value factories can be used to add constants or configuration parameters to the container,
//      * though these can also be added in scripts.
//      *
//      * @param name The name to identify the factory by.
//      * @param value The value the value factory is to return (as a singleton).
//      */
//     public void addValueFactory(String name, Object value);
// 
//     /**
//      * Replaces the existing factory with the given name, with the new factory passed as parameter.
//      * All factories referencing the old factory will hereafter reference the new factory.
//      * @param name       The name of the factory to replace.
//      * @param newFactory The new factory that is to replace the old.
//      * @return           The old factory - the one that was replaced.
//      */
//     public IGlobalFactory replaceFactory(String name, IGlobalFactory newFactory);
// 
//     /**
//      * Removes the factory identified by the given name from the container.
//      * @param name The name identifying the factory to remove.
//      */
//     public void removeFactory(String name);
// 
//     /**
//      * Returns the factory identified by the given name.
//      * @param name The name identifying the factory to return.
//      * @return The factory identified by the given name.
//      */
//     public IGlobalFactory getFactory(String name);
// 
//     /**
//      * Returns a Map containing all the factories in this container.
//      * @return A Map containing all the factories in this container.
//      */
//     public Map<String, IGlobalFactory> getFactories();
// 
//     /**
//      * Returns instance of whatever component the factory identified by the given
//      * name produces.
//      * @param name    The name of the factory to obtain an instance from. 
//      * @param parameters Any parameters needed by the factory to produce the component instance.
//      * @return An instance of the component the factory identified by the given name produces.
//      */
//     public Object instance(String name, Object ... parameters);
// 
//     /**
//      * Initializes the container. Currently this means creating all singletons and other cached instances.
//      */
//     public void init();
// 
//     /**
//      * Executes the given life cycle phase on all factories in the container.
//      * @param phase The name of the life cycle phase to execute ("config", "dipose" etc.)
//      */
//     public void execPhase(String phase);
// 
//     /**
//      * Executes the given life cycle phase on the factory identified by the given name.
//      * @param phase The name of the life cycle phase to execute ("config", "dispose" etc.)
//      * @param name The name of the factory to execute the life cycle phase on.
//      */
//     public void execPhase(String phase, String name);
// 
//     /**
//      * Executes the "dispose" life cycle phase on all factories in the container.
//      */
//     public void dispose();
// 
// }
// 
// Path: src/main/java/com/jenkov/container/Container.java
// public class Container implements IContainer {
// 
//     protected Map<String, IGlobalFactory> factories = null;
// 
//     public Container() {
//         this.factories = new ConcurrentHashMap<String, IGlobalFactory>();
//     }
// 
//     public Container(Map<String, IGlobalFactory> factories) {
//         this.factories = factories;
//     }
// 
// 
//     public void addFactory(String name, IGlobalFactory factory) {
//         if(this.factories.containsKey(name)) throw
//                 new ContainerException(
//                         "Container", "FACTORY_ALREADY_EXISTS",
//                         "Container already contains a factory with this name: " + name);
//         this.factories.put(name, new GlobalFactoryProxy(factory));
//     }
// 
//     public void addValueFactory(String id, Object value){
//         GlobalFactoryBase factory = new GlobalNewInstanceFactory();
//         factory.setLocalInstantiationFactory(new ValueFactory(value));
//         this.factories.put(id, new GlobalFactoryProxy(factory));
//     }
// 
//     public IGlobalFactory replaceFactory(String name, IGlobalFactory newFactory){
//         GlobalFactoryProxy factoryProxy = (GlobalFactoryProxy) this.factories.get(name);
//         if(factoryProxy == null) {
//             addFactory(name, newFactory);
//             return null;
//         } else {
//             return factoryProxy.setDelegateFactory(newFactory);
//         }
//     }
// 
//     public void removeFactory(String id) {
//         this.factories.remove(id);
//     }
// 
//     public IGlobalFactory getFactory(String id) {
//         IGlobalFactory factory = this.factories.get(id);
//         //if(factory == null) throw new ContainerException("Unknown Factory: " + id);
//         return factory;
//     }
// 
//     public Map<String, IGlobalFactory> getFactories() {
//         return this.factories;
//     }
// 
//     public Object instance(String id, Object ... parameters){
//         IGlobalFactory factory = this.factories.get(id);
//         if(factory == null) throw new ContainerException(
//                 "Container", "UNKNOWN_FACTORY",                    
//                 "Unknown Factory: " + id);
//         return factory.instance(parameters);
//     }
// 
//     public void init(){
//         for(String key : this.factories.keySet()){
//             Object factory = this.factories.get(key);
// 
//             if(factory instanceof GlobalFactoryProxy){
//                 factory = ((GlobalFactoryProxy) factory).getDelegateFactory();
//                 if(factory instanceof GlobalSingletonFactory){
//                     ((GlobalSingletonFactory) factory).instance();
//                 }
//             }
//         }
//     }
// 
//     public void dispose(){
//         execPhase("dispose");
//     }
// 
//     public void execPhase(String phase) {
//         for(String key : this.factories.keySet()){
//             execPhase(phase, key);
//         }
//     }
// 
//     public void execPhase(String phase, String factoryName) {
//         Object factory  = this.factories.get(factoryName);
//         if(factory instanceof GlobalFactoryProxy){
//             ((GlobalFactoryProxy) factory).execPhase(phase);
//         }
//     }
// 
// 
// }


import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
package com.jenkov.container.script;



/**

 */
public class Bugs extends TestCase {

    public void testExtraParanthesesErrorMessage(){
// Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
// 
//     /**
//      * Adds a factory to the container using the given name.
//      * @param name A name to identify the factory by.
//      * @param factory A factory producing some component.
//      */
//     public void addFactory(String name, IGlobalFactory factory);
// 
//     /**
//      * Adds a value factory to the container using the given name.
//      * A value factory just returns the value passed in the value parameter.
//      * Thus the value object becomes a singleton.
//      * Value factories can be used to add constants or configuration parameters to the container,
//      * though these can also be added in scripts.
//      *
//      * @param name The name to identify the factory by.
//      * @param value The value the value factory is to return (as a singleton).
//      */
//     public void addValueFactory(String name, Object value);
// 
//     /**
//      * Replaces the existing factory with the given name, with the new factory passed as parameter.
//      * All factories referencing the old factory will hereafter reference the new factory.
//      * @param name       The name of the factory to replace.
//      * @param newFactory The new factory that is to replace the old.
//      * @return           The old factory - the one that was replaced.
//      */
//     public IGlobalFactory replaceFactory(String name, IGlobalFactory newFactory);
// 
//     /**
//      * Removes the factory identified by the given name from the container.
//      * @param name The name identifying the factory to remove.
//      */
//     public void removeFactory(String name);
// 
//     /**
//      * Returns the factory identified by the given name.
//      * @param name The name identifying the factory to return.
//      * @return The factory identified by the given name.
//      */
//     public IGlobalFactory getFactory(String name);
// 
//     /**
//      * Returns a Map containing all the factories in this container.
//      * @return A Map containing all the factories in this container.
//      */
//     public Map<String, IGlobalFactory> getFactories();
// 
//     /**
//      * Returns instance of whatever component the factory identified by the given
//      * name produces.
//      * @param name    The name of the factory to obtain an instance from. 
//      * @param parameters Any parameters needed by the factory to produce the component instance.
//      * @return An instance of the component the factory identified by the given name produces.
//      */
//     public Object instance(String name, Object ... parameters);
// 
//     /**
//      * Initializes the container. Currently this means creating all singletons and other cached instances.
//      */
//     public void init();
// 
//     /**
//      * Executes the given life cycle phase on all factories in the container.
//      * @param phase The name of the life cycle phase to execute ("config", "dipose" etc.)
//      */
//     public void execPhase(String phase);
// 
//     /**
//      * Executes the given life cycle phase on the factory identified by the given name.
//      * @param phase The name of the life cycle phase to execute ("config", "dispose" etc.)
//      * @param name The name of the factory to execute the life cycle phase on.
//      */
//     public void execPhase(String phase, String name);
// 
//     /**
//      * Executes the "dispose" life cycle phase on all factories in the container.
//      */
//     public void dispose();
// 
// }
// 
// Path: src/main/java/com/jenkov/container/Container.java
// public class Container implements IContainer {
// 
//     protected Map<String, IGlobalFactory> factories = null;
// 
//     public Container() {
//         this.factories = new ConcurrentHashMap<String, IGlobalFactory>();
//     }
// 
//     public Container(Map<String, IGlobalFactory> factories) {
//         this.factories = factories;
//     }
// 
// 
//     public void addFactory(String name, IGlobalFactory factory) {
//         if(this.factories.containsKey(name)) throw
//                 new ContainerException(
//                         "Container", "FACTORY_ALREADY_EXISTS",
//                         "Container already contains a factory with this name: " + name);
//         this.factories.put(name, new GlobalFactoryProxy(factory));
//     }
// 
//     public void addValueFactory(String id, Object value){
//         GlobalFactoryBase factory = new GlobalNewInstanceFactory();
//         factory.setLocalInstantiationFactory(new ValueFactory(value));
//         this.factories.put(id, new GlobalFactoryProxy(factory));
//     }
// 
//     public IGlobalFactory replaceFactory(String name, IGlobalFactory newFactory){
//         GlobalFactoryProxy factoryProxy = (GlobalFactoryProxy) this.factories.get(name);
//         if(factoryProxy == null) {
//             addFactory(name, newFactory);
//             return null;
//         } else {
//             return factoryProxy.setDelegateFactory(newFactory);
//         }
//     }
// 
//     public void removeFactory(String id) {
//         this.factories.remove(id);
//     }
// 
//     public IGlobalFactory getFactory(String id) {
//         IGlobalFactory factory = this.factories.get(id);
//         //if(factory == null) throw new ContainerException("Unknown Factory: " + id);
//         return factory;
//     }
// 
//     public Map<String, IGlobalFactory> getFactories() {
//         return this.factories;
//     }
// 
//     public Object instance(String id, Object ... parameters){
//         IGlobalFactory factory = this.factories.get(id);
//         if(factory == null) throw new ContainerException(
//                 "Container", "UNKNOWN_FACTORY",                    
//                 "Unknown Factory: " + id);
//         return factory.instance(parameters);
//     }
// 
//     public void init(){
//         for(String key : this.factories.keySet()){
//             Object factory = this.factories.get(key);
// 
//             if(factory instanceof GlobalFactoryProxy){
//                 factory = ((GlobalFactoryProxy) factory).getDelegateFactory();
//                 if(factory instanceof GlobalSingletonFactory){
//                     ((GlobalSingletonFactory) factory).instance();
//                 }
//             }
//         }
//     }
// 
//     public void dispose(){
//         execPhase("dispose");
//     }
// 
//     public void execPhase(String phase) {
//         for(String key : this.factories.keySet()){
//             execPhase(phase, key);
//         }
//     }
// 
//     public void execPhase(String phase, String factoryName) {
//         Object factory  = this.factories.get(factoryName);
//         if(factory instanceof GlobalFactoryProxy){
//             ((GlobalFactoryProxy) factory).execPhase(phase);
//         }
//     }
// 
// 
// }


// Path: src/test/java/com/jenkov/container/script/Bugs.java
import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;

package com.jenkov.container.script;



/**

 */
public class Bugs extends TestCase {

    public void testExtraParanthesesErrorMessage(){
        IContainer container = new Container();