Buggy code:
public class ApacheConfig { public static final String APACHE_CONFIG = "//conf//jserv//tomcat-apache.conf" ; public static final String MOD_JK_CONFIG = "//conf//jk//mod_jk.conf" ; public static final String WORKERS_CONFIG = "//conf//jk//workers.properties" ; public static final String JK_LOG_LOCATION = "//logs//mod_jk.log" ; public ApacheConfig ( ) { } String findApache ( ) { } Log loghelper = new Log ( "tc_log" , this ) ; public void execute ( ContextManager cm ) throws TomcatException { String tomcatHome = cm . getHome ( ) ; String apacheHome = findApache ( ) ; FileWriter configW = new FileWriter ( ( tomcatHome + ( ApacheConfig . APACHE_CONFIG ) ) ) ; PrintWriter pw = new PrintWriter ( configW ) ; PrintWriter mod_jk = new PrintWriter ( new FileWriter ( ( ( tomcatHome + ( ApacheConfig . MOD_JK_CONFIG ) ) + "-auto" ) ) ) ; mod_jk . println ( "###################################################################" ) ; mod_jk . println ( ( "#<seq2seq4repair_space>Auto<seq2seq4repair_space>generated<seq2seq4repair_space>configuration.<seq2seq4repair_space>Dated:<seq2seq4repair_space>" + ( new Date ( ) ) ) ) ; mod_jk . println ( "###################################################################" ) ; mod_jk . println ( ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "#<seq2seq4repair_space>The<seq2seq4repair_space>following<seq2seq4repair_space>line<seq2seq4repair_space>instructs<seq2seq4repair_space>Apache<seq2seq4repair_space>to<seq2seq4repair_space>load<seq2seq4repair_space>the<seq2seq4repair_space>jk<seq2seq4repair_space>module" ) ; mod_jk . println ( "#" ) ; if ( ( System . getProperty ( "os.name" ) . toLowerCase ( ) . indexOf ( "windows" ) ) >= 0 ) { pw . println ( "LoadModule<seq2seq4repair_space>jserv_module<seq2seq4repair_space>modules//ApacheModuleJServ.dll" ) ; mod_jk . println ( "LoadModule<seq2seq4repair_space>jk_module<seq2seq4repair_space>modules//mod_jk.dll" ) ; mod_jk . println ( ) ; mod_jk . println ( ( ( "JkWorkersFile<seq2seq4repair_space>\"" + ( new File ( tomcatHome , ApacheConfig . WORKERS_CONFIG ) . toString ( ) . replace ( '\\' , '//' ) ) ) + "\"" ) ) ; mod_jk . println ( ( ( "JkLogFile<seq2seq4repair_space>\"" + ( new File ( tomcatHome , ApacheConfig . JK_LOG_LOCATION ) . toString ( ) . replace ( '\\' , '//' ) ) ) + "\"" ) ) ; } else { pw . println ( "LoadModule<seq2seq4repair_space>jserv_module<seq2seq4repair_space>libexec//mod_jserv.so" ) ; mod_jk . println ( "LoadModule<seq2seq4repair_space>jk_module<seq2seq4repair_space>libexec//mod_jk.so" ) ; mod_jk . println ( ) ; mod_jk . println ( ( "JkWorkersFile<seq2seq4repair_space>" + ( new File ( tomcatHome , ApacheConfig . WORKERS_CONFIG ) ) ) ) ; mod_jk . println ( ( "JkLogFile<seq2seq4repair_space>" + ( new File ( tomcatHome , ApacheConfig . JK_LOG_LOCATION ) ) ) ) ; } pw . println ( "ApJServManual<seq2seq4repair_space>on" ) ; pw . println ( "ApJServDefaultProtocol<seq2seq4repair_space>ajpv12" ) ; pw . println ( "ApJServSecretKey<seq2seq4repair_space>DISABLED" ) ; pw . println ( "ApJServMountCopy<seq2seq4repair_space>on" ) ; pw . println ( "ApJServLogLevel<seq2seq4repair_space>notice" ) ; pw . println ( ) ; int portInt = 8007 ; <START_BUG> BaseInterceptor [ ] ci = cm . getContextInterceptors ( ) ; <END_BUG> for ( int i = 0 ; i < ( ci . length ) ; i ++ ) { Object con = ci [ i ] ; if ( con instanceof Ajp12ConnectionHandler ) { PoolTcpConnector tcpCon = ( ( PoolTcpConnector ) ( con ) ) ; portInt = tcpCon . getPort ( ) ; } if ( con instanceof Ajp12Interceptor ) { Ajp12Interceptor tcpCon = ( ( Ajp12Interceptor ) ( con ) ) ; portInt = tcpCon . getPort ( ) ; } } pw . println ( ( "ApJServDefaultPort<seq2seq4repair_space>" + portInt ) ) ; pw . println ( ) ; pw . println ( "AddType<seq2seq4repair_space>text//jsp<seq2seq4repair_space>.jsp" ) ; pw . println ( "AddHandler<seq2seq4repair_space>jserv-servlet<seq2seq4repair_space>.jsp" ) ; pw . println ( ) ; mod_jk . println ( ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "#<seq2seq4repair_space>Log<seq2seq4repair_space>level<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>by<seq2seq4repair_space>mod_jk" ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "JkLogLevel<seq2seq4repair_space>error" ) ; mod_jk . println ( ) ; mod_jk . println ( "###################################################################" ) ; mod_jk . println ( "#<seq2seq4repair_space>SSL<seq2seq4repair_space>configuration<seq2seq4repair_space>#" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>By<seq2seq4repair_space>default<seq2seq4repair_space>mod_jk<seq2seq4repair_space>is<seq2seq4repair_space>configured<seq2seq4repair_space>to<seq2seq4repair_space>collect<seq2seq4repair_space>SSL<seq2seq4repair_space>information<seq2seq4repair_space>from" ) ; mod_jk . println ( "#<seq2seq4repair_space>the<seq2seq4repair_space>apache<seq2seq4repair_space>environment<seq2seq4repair_space>and<seq2seq4repair_space>send<seq2seq4repair_space>it<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>Tomcat<seq2seq4repair_space>workers.<seq2seq4repair_space>The" ) ; mod_jk . println ( "#<seq2seq4repair_space>problem<seq2seq4repair_space>is<seq2seq4repair_space>that<seq2seq4repair_space>there<seq2seq4repair_space>are<seq2seq4repair_space>many<seq2seq4repair_space>SSL<seq2seq4repair_space>solutions<seq2seq4repair_space>for<seq2seq4repair_space>Apache<seq2seq4repair_space>and<seq2seq4repair_space>as" ) ; mod_jk . println ( "#<seq2seq4repair_space>a<seq2seq4repair_space>result<seq2seq4repair_space>the<seq2seq4repair_space>environment<seq2seq4repair_space>variable<seq2seq4repair_space>names<seq2seq4repair_space>may<seq2seq4repair_space>change." ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "#<seq2seq4repair_space>The<seq2seq4repair_space>following<seq2seq4repair_space>(commented<seq2seq4repair_space>out)<seq2seq4repair_space>JK<seq2seq4repair_space>related<seq2seq4repair_space>SSL<seq2seq4repair_space>configureation" ) ; mod_jk . println ( "#<seq2seq4repair_space>can<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>to<seq2seq4repair_space>customize<seq2seq4repair_space>mod_jk's<seq2seq4repair_space>SSL<seq2seq4repair_space>behaviour." ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>Should<seq2seq4repair_space>mod_jk<seq2seq4repair_space>send<seq2seq4repair_space>SSL<seq2seq4repair_space>information<seq2seq4repair_space>to<seq2seq4repair_space>Tomact<seq2seq4repair_space>(default<seq2seq4repair_space>is<seq2seq4repair_space>On)" ) ; mod_jk . println ( "#<seq2seq4repair_space>JkExtractSSL<seq2seq4repair_space>Off" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>What<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>indicator<seq2seq4repair_space>for<seq2seq4repair_space>SSL<seq2seq4repair_space>(default<seq2seq4repair_space>is<seq2seq4repair_space>HTTPS)" ) ; mod_jk . println ( "#<seq2seq4repair_space>JkHTTPSIndicator<seq2seq4repair_space>HTTPS" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>What<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>indicator<seq2seq4repair_space>for<seq2seq4repair_space>SSL<seq2seq4repair_space>session<seq2seq4repair_space>(default<seq2seq4repair_space>is<seq2seq4repair_space>SSL_SESSION_ID)" ) ; mod_jk . println ( "#<seq2seq4repair_space>JkSESSIONIndicator<seq2seq4repair_space>SSL_SESSION_ID" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>What<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>indicator<seq2seq4repair_space>for<seq2seq4repair_space>client<seq2seq4repair_space>SSL<seq2seq4repair_space>cipher<seq2seq4repair_space>suit<seq2seq4repair_space>(default<seq2seq4repair_space>is<seq2seq4repair_space>SSL_CIPHER)" ) ; mod_jk . println ( "#<seq2seq4repair_space>JkCIPHERIndicator<seq2seq4repair_space>SSL_CIPHER" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>What<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>indicator<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>client<seq2seq4repair_space>SSL<seq2seq4repair_space>certificated<seq2seq4repair_space>(default<seq2seq4repair_space>is<seq2seq4repair_space>SSL_CLIENT_CERT)" ) ; mod_jk . println ( "#<seq2seq4repair_space>JkCERTSIndicator<seq2seq4repair_space>SSL_CLIENT_CERT" ) ; mod_jk . println ( "#<seq2seq4repair_space>" ) ; mod_jk . println ( "#<seq2seq4repair_space>#" ) ; mod_jk . println ( "###################################################################" ) ; mod_jk . println ( ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "#<seq2seq4repair_space>Root<seq2seq4repair_space>context<seq2seq4repair_space>mounts<seq2seq4repair_space>for<seq2seq4repair_space>Tomcat" ) ; mod_jk . println ( "#" ) ; mod_jk . println ( "JkMount<seq2seq4repair_space>//*.jsp<seq2seq4repair_space>ajp12" ) ; mod_jk . println ( "JkMount<seq2seq4repair_space>//servlet//*<seq2seq4repair_space>ajp12" ) ; mod_jk . println ( ) ; Enumeration = cm . getContexts ( ) ; } }

Fix:
BaseInterceptor [ ] ci = cm . getInterceptors ( ) ;