com.thoughtworks.xstream.XStreamException Java Examples

The following examples show how to use com.thoughtworks.xstream.XStreamException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlobalPropertiesConfigDeserializerTest.java    From openmrs-module-initializer with MIT License 5 votes vote down vote up
@Test(expected = XStreamException.class)
@Verifies(value = "should throw XStream exception on invalid config", method = "fromXML(InputStream input)")
public void shouldThrowException() {
	
	InitializerSerializer.getGlobalPropertiesConfig(
	    getClass().getClassLoader().getResourceAsStream("org/openmrs/module/initializer/include/gp_error.xml"));
}
 
Example #2
Source File: MemoryDataSourceManager.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public void load() {
    XStream xstream = createXStream();
    try {
        DataSources ds =  (DataSources)xstream.fromXML(datasourcesXml);
        sources = ds.getList();

        if (sources.size() > Globals.getDataSources()) {
            int toDelete = sources.size() - Globals.getDataSources();
            for (int i = 0; i < toDelete; i++) {
                sources.remove(0);
            }
        }
        decryptSourcePasswords();

        for (DataSource s : sources) {
            (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + s.getName() + File.separator + FileReportPersistence.QUERIES_FOLDER)).mkdirs();
            (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + s.getName() + File.separator + FileReportPersistence.REPORTS_FOLDER)).mkdirs();
            (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + s.getName() + File.separator + FileReportPersistence.CHARTS_FOLDER)).mkdirs();
        }

    } catch (XStreamException e) {
    	LOG.error("datasourcesXml = '" + datasourcesXml + "'");
        LOG.error(e.getMessage(), e);
        Show.error(e);
    } catch (Exception ex) {
        LOG.error("datasourcesXml = '" + datasourcesXml + "'");
        LOG.error(ex.getMessage(), ex);
        Show.error(ex);
    }
}