/** Return a list object for this header if it has an associated list object. */ protected static SIPHeaderList getList(SIPHeader sipHeader) { if (!initialized) initializeListMap(); try { Class headerClass = sipHeader.getClass(); Class listClass = (Class) headerListTable.get(headerClass); return (SIPHeaderList) listClass.newInstance(); } catch (InstantiationException ex) { InternalError.handleException(ex); } catch (IllegalAccessException ex) { InternalError.handleException(ex); } return null; }
/** Constructor. */ protected XMLContentHandler(String eventFile, String agentFile) { myEngine = EventEngine.theStack; agentTable = new Hashtable(); try { XMLReader saxParser = (XMLReader) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance(); saxParser.setContentHandler(this); saxParser.setFeature("http://xml.org/sax/features/validation", true); // parse the xml specification for the event tags. saxParser.parse(agentFile); saxParser.parse(eventFile); } catch (SAXParseException spe) { // Error generated by the parser System.out.println( "\n** Parsing error" + ", line " + spe.getLineNumber() + ", uri " + spe.getSystemId()); System.out.println(" " + spe.getMessage()); // Use the contained exception, if any Exception x = spe; if (spe.getException() != null) x = spe.getException(); x.printStackTrace(); System.exit(0); } catch (SAXException sxe) { // Error generated by this application // (or a parser-initialization error) Exception x = sxe; if (sxe.getException() != null) x = sxe.getException(); x.printStackTrace(); System.exit(0); } catch (IOException ioe) { // I/O error ioe.printStackTrace(); System.exit(0); } catch (Exception pce) { // Parser with specified options can't be built pce.printStackTrace(); System.exit(0); } }