public String getFirstTopicId ( final URI file , final boolean useCatalog ) { assert file . isAbsolute ( ) ; if ( ! ( new File ( file ) . exists ( ) ) ) { return null ; } final StringBuilder firstTopicId = new StringBuilder ( ) ; final TopicIdParser parser = new TopicIdParser ( firstTopicId ) ; try { final XMLReader reader = XMLUtils . getXMLReader ( ) ; reader . setContentHandler ( parser ) ; if ( useCatalog ) { reader . setEntityResolver ( CatalogUtils . getCatalogResolver ( ) ) ; } reader . parse ( file . toString ( ) ) ; } catch ( final Exception e ) { logger . error ( e . getMessage ( ) , e ) ; } return firstTopicId . toString ( ) ; }
Get the first topic id .