List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError
public ExceptionInInitializerError(String s)
From source file:org.webical.plugin.xml.PluginManifestReader.java
/** * Prepares the plugin schema//from w ww. j ava 2 s . c o m * @throws Exception */ public void afterPropertiesSet() throws Exception { //load the plugin xsd try { loadPluginSchema(); } catch (IOException e) { log.fatal("Could not load schema file", e); throw e; } if (webicalPluginSchema == null || !webicalPluginSchema.exists()) { log.error("Xsd does not exist: " + (webicalPluginSchema != null ? webicalPluginSchema.getAbsolutePath() : null) + " (relative: " + webicalPluginSchemaLocation + ")"); throw new ExceptionInInitializerError("Xsd does not exist: " + (webicalPluginSchema != null ? webicalPluginSchema.getAbsolutePath() : null) + " (relative: " + webicalPluginSchemaLocation + ")"); } }
From source file:org.paxle.data.impl.Activator.java
private URL getConfigURL(BundleContext context) throws MalformedURLException { URL config = null;/*from www .j av a 2 s .co m*/ HashMap<String, URL> availableConfigs = this.getAvailableConfigFiles(context); if (availableConfigs.size() == 0) { String errorMsg = "No config files found"; this.logger.error(errorMsg); throw new ExceptionInInitializerError(errorMsg); } /* * Getting the config file to use */ String configStr = System.getProperty("CommandDB.configFile"); if (configStr != null) { // the user has chosen a custom config file via system-properties if (availableConfigs.containsKey(configStr)) { // the props value is a key (e.g. "derby") config = availableConfigs.get(configStr); } else { // the props value is an URL config = new URL(configStr); } } else { // using the default config file if (availableConfigs.containsKey("derby")) { config = availableConfigs.get("derby"); } else { // just use the first found file config = availableConfigs.values().iterator().next(); } } this.logger.info(String.format("Loading db configuration from '%s' ...", config.toString())); return config; }
From source file:com.nextep.datadesigner.hibernate.HibernateUtil.java
private void initializeSessions() { try {/*from ww w .j a v a2 s . c o m*/ setMonitorTaskName(CoreMessages.getString("hibernateInit")); //$NON-NLS-1$ final IRepositoryService repositoryService = CorePlugin.getRepositoryService(); // Creating SessionFactory from hibernate.cfg.xml Configuration conf = new Configuration(); addDynamicHibernateMappings(conf); hibernateConfig = conf.configure(); final Properties p = hibernateConfig.getProperties(); // Setting Hibernate properties final IConnection conn = repositoryService.getRepositoryConnection(); final IDatabaseConnector<?> connector = repositoryService.getRepositoryConnector(); p.setProperty("hibernate.connection.url", connector.getConnectionURL(conn)); //$NON-NLS-1$ p.setProperty("hibernate.connection.driver_class", connector.getJDBCDriverClassName()); //$NON-NLS-1$ if (!conn.isSsoAuthentication()) { p.setProperty("hibernate.connection.username", conn.getLogin()); //$NON-NLS-1$ p.setProperty("hibernate.connection.password", conn.getPassword()); //$NON-NLS-1$ } final String schema = conn.getSchema(); if (schema != null && !"".equals(schema)) { //$NON-NLS-1$ p.setProperty("hibernate.default_schema", conn.getSchema()); //$NON-NLS-1$ } final DBVendor dbVendor = conn.getDBVendor(); switch (dbVendor) { case ORACLE: p.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle9iDialect"); //$NON-NLS-1$ //$NON-NLS-2$ break; case MYSQL: p.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); //$NON-NLS-1$ //$NON-NLS-2$ break; case POSTGRE: p.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$ break; case DB2: p.setProperty("hibernate.dialect", "org.hibernate.dialect.DB2Dialect"); //$NON-NLS-1$ //$NON-NLS-2$ break; case MSSQL: p.setProperty("hibernate.dialect", "org.hibernate.dialect.SQLServerDialect"); //$NON-NLS-1$ //$NON-NLS-2$ break; } hibernateConfig.setProperties(p); // Adding listeners addConfigurationListeners(hibernateConfig); initSessionFactory(); // Opening main and sandbox sessions mainSession = openCachedSession(); openSandBoxSession(); setMonitorTaskName(CoreMessages.getString("hibernateInitEnd")); //$NON-NLS-1$ } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println(CoreMessages.getString("hibernate.session.creationFailed") + ex); //$NON-NLS-1$ ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } }
From source file:com.ashon.associates.android.ashonflickr.FlickrApi.java
/** * Constructor type two//from ww w .j a v a 2 s . c o m * * @param String API Key * @return boolean True on success */ public FlickrApi init(Context context, String apiKey) { // Store the context this.setContext(context); // Store the API key if (!apiKey.equals("")) { setApiKey(apiKey); } else { throw new ExceptionInInitializerError("Empty API Key provided!"); } return this; }
From source file:biz.mosil.webtools.MosilWeb.java
/** * Get HTTP status after action GET/POST/Invoke * @return {@link org.apache.http.HttpStatus}. * Example: 200(SC_OK), 404(SC_NOT_FOUND), etc. * /*ww w .j a v a2s.c o m*/ * @see <a href="http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpStatus.html">HTTP Status</a><br /> * <a href="http://support.google.com/webmasters/bin/answer.py?hl=en&answer=40132">HTTP status codes from Google(English)</a><br /> * <a href="http://support.google.com/webmasters/bin/answer.py?hl=zh-Hant&answer=40132">HTTP status codes from Google()</a><br /> * * */ public int getResponseStatus() { if (mHttpResponse == null) { throw new ExceptionInInitializerError(mContext.getString(R.string.exce_after_connect)); } return mHttpResponse.getStatusLine().getStatusCode(); }
From source file:biz.mosil.webtools.MosilWeb.java
/** * Target URL /*from w w w . j a v a2s . c o m*/ * */ private void chkHostName() { if (mHostName == null || mHostName.equals("")) { throw new ExceptionInInitializerError(mContext.getString(R.string.exce_init_set_url)); } }
From source file:org.webical.plugin.registration.PluginSystemInitializer.java
protected boolean pluginPathsSet() { //Check the plugin directories if (pluginPaths != null && pluginPaths.size() > 0) { for (String pluginPath : pluginPaths) { File pluginPathFile = new File(pluginPath); if (!pluginPathFile.exists()) { throw new ExceptionInInitializerError("Plugin path does not exist: " + pluginPath); }//from w w w.j av a 2 s .c o m if (!pluginPathFile.isDirectory()) { throw new ExceptionInInitializerError("Plugin path is not a directory: " + pluginPath); } } //Check the output directory if (pluginWorkPath == null || pluginWorkPath.length() == 0) { throw new ExceptionInInitializerError("No plugin output path is defined"); } File pluginWorkPathFile = new File(pluginWorkPath); if (!pluginWorkPathFile.exists()) { throw new ExceptionInInitializerError("Plugin output path does not exist: " + pluginWorkPath); } if (!pluginWorkPathFile.isDirectory()) { throw new ExceptionInInitializerError("Plugin output path is not a directory: " + pluginWorkPath); } if (!pluginWorkPathFile.canWrite()) { throw new ExceptionInInitializerError("Plugin output path is not writeable: " + pluginWorkPath); } if (log.isDebugEnabled()) { log.debug("Plugin work directory: " + pluginWorkPath); } return true; } else { log.info("No plugin paths defided. Not setting up the plugin system"); return false; } }
From source file:edu.usc.goffish.gopher.impl.client.GopherClient.java
/** * Send the start signal to gopher.Which will start executing *///ww w. j av a2s. co m public void start() { if (sender == null) { String msg = "Gopher client is not initialized properly"; handleException(msg, new ExceptionInInitializerError(msg)); } BSPMessage message = new BSPMessage(); message.setType(BSPMessage.CTRL); message.setSuperStep(0); message.setTag(BSPMessage.INIT_ITERATION); Message tempMessage = new MessageImpl(); tempMessage.putPayload(BitConverter.getBytes(message)); sender.send(tempMessage); }
From source file:br.gov.jfrj.siga.model.dao.HibernateUtil.java
public static void configurarHibernate(String resource, String hibernateConnectionUrl, Class<?>... classesAnotadas) { try {/*from w w w . j av a2s .co m*/ Boolean fUseDatasource = null; String sUseDatasource = System.getProperty("siga.use.datasource"); if (sUseDatasource != null) { fUseDatasource = Boolean.valueOf(sUseDatasource); } if (classesAnotadas != null) conf = criarConfiguracao(resource, classesAnotadas); else conf = criarConfiguracao(resource); if (hibernateConnectionUrl != null) conf.setProperty("hibernate.connection.url", hibernateConnectionUrl); if (fUseDatasource != null) { if (fUseDatasource) { conf.setProperty("connection.datasource", conf.getProperty("siga.connection.datasource")); conf.getProperties().remove("hibernate.connection.url"); conf.getProperties().remove("hibernate.connection.username"); conf.getProperties().remove("hibernate.connection.password"); conf.getProperties().remove("hibernate.connection.driver_class"); } else { conf.getProperties().remove("connection.datasource"); conf.setProperty("hibernate.connection.url", conf.getProperty("siga.hibernate.connection.url")); conf.setProperty("hibernate.connection.username", conf.getProperty("siga.hibernate.connection.username")); conf.setProperty("hibernate.connection.password", conf.getProperty("siga.hibernate.connection.password")); conf.setProperty("hibernate.connection.driver_class", conf.getProperty("siga.hibernate.connection.driver_class")); } } if (hibernateConnectionUrl != null && hibernateConnectionUrl.equals("test")) { conf.getProperties().remove("connection.datasource"); conf.setProperty("hibernate.connection.url", conf.getProperty("siga.test.hibernate.connection.url")); conf.setProperty("hibernate.connection.username", conf.getProperty("siga.test.hibernate.connection.username")); conf.setProperty("hibernate.connection.password", conf.getProperty("siga.test.hibernate.connection.password")); conf.setProperty("hibernate.connection.driver_class", conf.getProperty("siga.test.hibernate.connection.driver_class")); } sessionFactory = conf.buildSessionFactory(); } catch (final Throwable ex) { // Make sure you log the exception, as it might be swallowed System.out.println("HibernateUtil"); ex.printStackTrace(); HibernateUtil.logger.error("No foi possvel configurar o hibernate.", ex); throw new ExceptionInInitializerError(ex); } }
From source file:edu.usc.goffish.gopher.impl.client.GopherClient.java
public void start(int numberOfIterations) { if (sender == null) { String msg = "Gopher client is not initialized properly"; handleException(msg, new ExceptionInInitializerError(msg)); }/*from ww w. ja v a2 s . c om*/ if (numberOfIterations <= 0) { start(); return; } BSPMessage message = new BSPMessage(); message.setType(BSPMessage.CTRL); message.setSuperStep(0); message.setTag(BSPMessage.INIT_ITERATION); message.setIterative(true); message.setNumberOfIterations(numberOfIterations); Message tempMessage = new MessageImpl(); tempMessage.putPayload(BitConverter.getBytes(message)); sender.send(tempMessage); }