List of usage examples for org.xml.sax SAXException getStackTrace
public StackTraceElement[] getStackTrace()
From source file:com.esri.geoevent.solutions.adapter.cot.CoTAdapterInbound.java
private void parseUsingStream(ByteBuffer bb) { try {/*from w w w . j a v a 2 s .c o m*/ int remaining = bb.remaining(); System.out.println("buf-copy remaining: " + bb.remaining()); if (remaining <= 0) return; byte[] bytes = new byte[remaining]; bb.get(bytes); saxParser.parse(new ByteArrayInputStream(bytes), messageParser); bytes = null; } catch (SAXException e) { log.error(e); log.error(e.getStackTrace()); } catch (IOException e) { log.error(e); log.error(e.getStackTrace()); } }
From source file:org.easyrec.plugin.profileduke.ProfileDukeGenerator.java
/** * This procedure calculates loads the duke configuration, * reads the item profiles, starts duke to calculate the * similarities and writes them as associations in the DB. * * @param items a list of items which should contain all users of your tenant * @return <code>true</code> if the calculation succeeds and <code>false</code> if an * error occurs//from w ww . j a va 2 s . c o m * @throws IOException */ private boolean prepareAndStartDuke(List<ItemVO<Integer, Integer>> items) throws IOException { ProfileDukeConfiguration config = getConfiguration(); String dukeConfigurationString = config.getDukeConfiguration(); TypeMappingService typeMappingService = (TypeMappingService) super.getTypeMappingService(); Integer associationType = typeMappingService.getIdOfAssocType(config.getTenantId(), config.getAssociationType()); Integer sourceType = typeMappingService.getIdOfSourceType(config.getTenantId(), this.getId().toString()); Integer viewType = typeMappingService.getIdOfViewType(config.getTenantId(), config.getViewType()); Configuration dukeConfig = null; try { dukeConfig = ConfigLoader.loadFromString(dukeConfigurationString); } catch (SAXException e) { logger.error("An error occurred while parsing Duke configuration: " + e.getMessage()); logger.debug(e.getStackTrace()); return false; } catch (IOException e) { logger.error("An error occurred while parsing Duke configuration: " + e.getMessage()); logger.debug(e.getStackTrace()); return false; } List<Property> propertyList = dukeConfig.getProperties(); propertyList.add(new Property("ID")); Property itemIDProperty = new Property("ItemID"); itemIDProperty.setIgnoreProperty(true); propertyList.add(itemIDProperty); dukeConfig.setProperties(propertyList); lastThreshold = dukeConfig.getThreshold(); //read properties List<Property> props = dukeConfig.getProperties(); EasyrecXMLFormatDataSource dataSource = new EasyrecXMLFormatDataSource(); dataSource.setItems(items); dataSource.setProfileService(profileService); for (Property prop : props) { if (prop.getName().equals("ID")) { dataSource.addColumn(new Column("?uri", "ID", null, null)); } else { dataSource.addColumn(new Column(prop.getName(), prop.getName(), null, null)); } } dataSource.setProps(props); dukeConfig.addDataSource(0, dataSource); Processor proc = new Processor(dukeConfig); EasyrecProfileMatcher easyrecProfileMatcher = new EasyrecProfileMatcher(false, true, this); easyrecProfileMatcher.setItemAssocDAO(profileSimilarityItemAssocDAO); easyrecProfileMatcher.setAssocType(associationType); easyrecProfileMatcher.setConfTanantId(config.getTenantId()); easyrecProfileMatcher.setSourceType(sourceType); easyrecProfileMatcher.setViewType(viewType); proc.addMatchListener(easyrecProfileMatcher); proc.deduplicate(); proc.close(); return true; }
From source file:org.limy.common.xml.XmlUtils.java
/** * XML??DOM Document???//w ww . j a va2 s . c o m * @param in XML * @return DOM Document * @throws IOException I/O */ public static Document parseDoc(InputStream in) throws IOException { try { return createBuilder().parse(in); } catch (SAXException e) { IOException exception = new IOException(e.getMessage()); exception.setStackTrace(e.getStackTrace()); throw exception; } }
From source file:org.limy.common.xml.XmlUtils.java
/** * XML??XMLElement???/* w w w.java 2 s.c om*/ * @param in XML * @return XMLElement * @throws IOException I/O */ public static XmlElement parse(InputStream in) throws IOException { try { Document document = createBuilder().parse(in); Element root = document.getDocumentElement(); SimpleElement el = new SimpleElement(root.getNodeName()); parse(el, root); return el; } catch (SAXException e) { IOException exception = new IOException(e.getMessage()); exception.setStackTrace(e.getStackTrace()); throw exception; } }
From source file:org.wso2.carbon.automation.engine.test.configuration.ConfigurationXSDValidatorTest.java
@Test(groups = "context.unit.test", description = "Upload aar service and verify deployment") public void validateAutomationXml() throws IOException, SAXException { boolean validated = false; URL schemaFile = validateXsdFile.toURI().toURL(); Source xmlFile = new StreamSource(configXmlFile); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaFile); Validator validator = schema.newValidator(); try {/* ww w. j a v a 2s. c o m*/ validator.validate(xmlFile); validated = true; } catch (SAXException e) { log.error(e.getStackTrace()); throw new SAXException(e); } Assert.assertTrue(validated); }