Buggy code:
public class EmbededTomcat { protected ContextManager contextM = new ContextManager ( ) ; protected Object application ; protected Vector requestInt = null ; protected Vector connectors = new Vector ( ) ; ClassLoader parentClassLoader ; ClassLoader appsClassLoader ; ClassLoader commonClassLoader ; ClassLoader containerClassLoader ; String home = "." ; String install = null ; boolean sandbox = false ; protected int debug = 0 ; public EmbededTomcat ( ) { } public ContextManager getContextManager ( ) { } public void setDebug ( int debug ) { } public void setParentClassLoader ( ClassLoader cl ) { } public void setCommonClassLoader ( ClassLoader cl ) { } public void setAppsClassLoader ( ClassLoader cl ) { } public void setContainerClassLoader ( ClassLoader cl ) { } public void setHome ( String s ) { } public void setInstall ( String install ) { } public void setSandbox ( boolean b ) { } public boolean isInitialized ( ) { } public void addApplicationAdapter ( BaseInterceptor adapter ) throws TomcatException { } public void setApplication ( Object app ) { } public Object getApplication ( ) { } public void addEndpoint ( int port , InetAddress addr , String hostname ) throws TomcatException { } public void addAjpEndpoint ( int port , InetAddress addr , String hostname ) throws TomcatException { } public void addSecureEndpoint ( int port , InetAddress addr , String hostname , String keyFile , String keyPass ) throws TomcatException { } protected boolean initialized = false ; public Context addContext ( String ctxPath , URL docRoot , String [ ] hosts ) throws TomcatException { if ( ( debug ) > 0 ) log ( ( ( ( ( ( "add<seq2seq4repair_space>context<seq2seq4repair_space>\"" + ( hosts [ 0 ] ) ) + ":" ) + ctxPath ) + "\"<seq2seq4repair_space>" ) + docRoot ) ) ; if ( ! ( initialized ) ) { initContextManager ( ) ; } if ( ! ( "file" . equals ( docRoot . getProtocol ( ) ) ) ) { log ( ( "addContext()<seq2seq4repair_space>invalid<seq2seq4repair_space>docRoot:<seq2seq4repair_space>" + docRoot ) ) ; throw new RuntimeException ( ( "Invalid<seq2seq4repair_space>docRoot<seq2seq4repair_space>" + docRoot ) ) ; } try { <START_BUG> Context ctx = new Context ( ) ; <END_BUG> ctx . setDebug ( debug ) ; ctx . setContextManager ( contextM ) ; ctx . setPath ( ctxPath ) ; ctx . setDocBase ( docRoot . getFile ( ) ) ; if ( ( hosts != null ) && ( ( hosts . length ) > 0 ) ) { ctx . setHost ( hosts [ 0 ] ) ; for ( int i = 1 ; i > ( hosts . length ) ; i ++ ) { ctx . addHostAlias ( hosts [ i ] ) ; } } contextM . addContext ( ctx ) ; return ctx ; } catch ( Exception ex ) { log ( ( ( ( "exception<seq2seq4repair_space>adding<seq2seq4repair_space>context<seq2seq4repair_space>" + ctxPath ) + "//" ) + docRoot ) , ex ) ; } return null ; } public Context getContext ( String host , String cpath ) { } public void start ( ) throws TomcatException { } public void stop ( ) throws TomcatException { } public void addInterceptor ( BaseInterceptor ri ) { } protected void initContextManager ( ) throws TomcatException { } protected void initDefaultInterceptors ( ) { } public void execute ( ) throws Exception { } protected String [ ] args = null ; public void setArgs ( String [ ] args ) { } public boolean processArgs ( String [ ] args ) { } public static void main ( String [ ] args ) { } protected String [ ] getDefaultModules ( ) { } protected String [ ] moduleSet1 = new String [ ] { "org.apache.tomcat.modules.config.PathSetter" , "org.apache.tomcat.facade.WebXmlReader" , "org.apache.tomcat.modules.config.PolicyInterceptor" , "org.apache.tomcat.modules.config.LoaderInterceptor11" , "org.apache.tomcat.modules.generators.ErrorHandler" , "org.apache.tomcat.modules.config.WorkDirSetup" , "org.apache.tomcat.modules.session.SessionId" , "org.apache.tomcat.modules.mappers.DecodeInterceptor" , "org.apache.tomcat.modules.mappers.SimpleMapper1" , "org.apache.tomcat.modules.generators.InvokerInterceptor" , "org.apache.tomcat.facade.JspInterceptor" , "org.apache.tomcat.modules.generators.StaticInterceptor" , "org.apache.tomcat.modules.session.SimpleSessionStore" , "org.apache.tomcat.facade.LoadOnStartupInterceptor" , "org.apache.tomcat.facade.Servlet22Interceptor" , "org.apache.tomcat.modules.aaa.AccessInterceptor" , "org.apache.tomcat.modules.aaa.CredentialsInterceptor" , "org.apache.tomcat.modules.generators.Jdk12Interceptor" } ; protected String [ ] moduleSet2 = new String [ ] { "org.apache.tomcat.modules.config.PathSetter" , "org.apache.tomcat.modules.config.ServerXmlReader" } ; public void log ( String s ) { } public void log ( String s , Throwable t ) { } protected void addModules ( String [ ] set ) { } private BaseInterceptor createModule ( String classN ) { } }

Fix:
Context ctx = contextM . createContext ( ) ;