public String [ ] compile ( String [ ] names ) throws IOException { if ( ! TemplateRepository . isInitialized ( ) ) { return compile0 ( names ) ; } String [ ] compNames = compile0 ( names ) ; ArrayList < String > compList = new ArrayList < String > ( Arrays . asList ( compNames ) ) ; TemplateRepository rep = TemplateRepository . getInstance ( ) ; String [ ] callers = rep . getCallersNeedingRecompile ( compNames , this ) ; if ( callers . length > 0 ) compList . addAll ( Arrays . asList ( compile0 ( callers ) ) ) ; String [ ] compiled = compList . toArray ( new String [ compList . size ( ) ] ) ; // JoshY - There's a VM bug in JVM 1.4.2 that can cause the repository // update to throw a NullPointerException when it shouldn't. There's a // workaround in place and we also put a catch here, to allow the // TeaServlet init to finish just in case try { rep . update ( compiled ) ; } catch ( Exception e ) { System . err . println ( "Unable to update repository" ) ; e . printStackTrace ( System . err ) ; } return compiled ; }
Compile a list of compilation units . This method can be called multiple times but it will not compile compilation units that have already been compiled .