private static SAXParser getSAXParser ( ) { SoftReference < SAXParser > ref = PARSER . get ( ) ; SAXParser result = ref . get ( ) ; if ( result == null ) { Exception thrown ; try { result = SAX_FACTORY . newSAXParser ( ) ; ref = new SoftReference < SAXParser > ( result ) ; PARSER . set ( ref ) ; return result ; } catch ( ParserConfigurationException ex ) { thrown = ex ; } catch ( SAXException ex ) { thrown = ex ; } throw ( new IllegalStateException ( "Could not create SAX parser" , thrown ) ) ; } else { result . reset ( ) ; return result ; } }
Gets a SAXParser for use in parsing incoming messages .