Example usage for java.lang ExceptionInInitializerError ExceptionInInitializerError

List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError

Introduction

In this page you can find the example usage for java.lang ExceptionInInitializerError ExceptionInInitializerError.

Prototype

public ExceptionInInitializerError(String s) 

Source Link

Document

Constructs an ExceptionInInitializerError with the specified detail message string.

Usage

From source file:com.manydesigns.portofino.persistence.hibernate.HibernateConfig.java

public Configuration buildSessionFactory(Database database) {
    try {//from w  ww .jav  a2  s.  c  om
        Configuration configuration = new Configuration();

        setupConnection(configuration);
        setupConfigurationProperties(configuration);

        Mappings mappings = configuration.createMappings();

        //Class Mapping
        classMapping(database, mappings);
        //One2Many Mapping
        o2mMapping(database, configuration, mappings);
        //Many2One Mapping
        m2oMapping(database, configuration, mappings);

        return configuration;
    } catch (Throwable ex) {
        // Make sure you log the exception, as it might be swallowed
        System.err.println("Initial SessionFactory creation failed." + ex);
        ex.printStackTrace();
        throw new ExceptionInInitializerError(ex);
    }
}

From source file:com.ejisto.modules.conf.ObjectFactoryLoader.java

void init() {
    try {// w  w  w .j  av  a 2 s . c  o m
        if (System.getProperty(StringConstants.EXTENSIONS_DIR.getValue()) == null) {
            return;
        }
        directory = new File(System.getProperty(StringConstants.EXTENSIONS_DIR.getValue()));
        cp = new ClassPool(ClassPool.getDefault());
        bazeClazz = cp.get(ObjectFactory.class.getName());
        initialized = true;
    } catch (Exception e) {
        throw new ExceptionInInitializerError(e);
    }
}

From source file:io.valuesfeng.picker.Picker.java

/**
 * Start to select photo.//  ww w .  ja  v a2  s .c om
 *
 * @param requestCode identity of the requester activity.
 */
public void forResult(int requestCode) {
    if (engine == null)
        throw new ExceptionInInitializerError(LoadEngine.INITIALIZE_ENGINE_ERROR);

    Activity activity = getActivity();
    if (activity == null) {
        return; // cannot continue;
    }
    mSelectionSpec.setMimeTypeSet(mMimeType);
    mSelectionSpec.setEngine(engine);
    Intent intent = new Intent(activity, ImageSelectActivity.class);
    intent.putExtra(ImageSelectActivity.EXTRA_SELECTION_SPEC, mSelectionSpec);
    //        intent.putExtra(ImageSelectActivity.EXTRA_ENGINE, (Serializable) engine);
    intent.putParcelableArrayListExtra(ImageSelectActivity.EXTRA_RESUME_LIST,
            (ArrayList<? extends android.os.Parcelable>) mResumeList);

    Fragment fragment = getFragment();
    if (fragment != null) {
        fragment.startActivityForResult(intent, requestCode);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
    hasInitPicker = false;
}

From source file:org.wisdom.test.WisdomBlackBoxRunner.java

private File checkWisdomInstallation() {
    File directory = new File("target/wisdom");
    if (!directory.isDirectory()) {
        throw new ExceptionInInitializerError("Wisdom is not installed in " + directory.getAbsolutePath()
                + " - "
                + "please check your execution directory, and that Wisdom is prepared correctly. To setup Wisdom, "
                + "run 'mvn pre-integration-test' from your application directory");
    }/*w  w w . j  a  va 2 s  .c  om*/
    File conf = new File(directory, "conf/application.conf");
    if (!conf.isFile()) {
        throw new ExceptionInInitializerError("Wisdom is not correctly installed in "
                + directory.getAbsolutePath()
                + " - the configuration file does not exist. Please check your Wisdom runtime. To setup Wisdom, "
                + "run 'mvn clean pre-integration-test' from your application directory");
    }
    return directory;
}

From source file:io.valuesfeng.picker.Picker.java

public static Picker from(Activity activity) {
    if (hasInitPicker)
        throw new ExceptionInInitializerError(INITIALIZE_PICKER_ERROR);
    hasInitPicker = true;//  w  ww . ja v  a 2s  .c o  m
    return new Picker(activity, null);
}

From source file:lu.list.itis.dkd.aig.SimilarityProvider.java

/**
 * Method for initializing the semantic similarity bridge.
 *
 * @throws ExceptionInInitializerError// w w  w  . j  a v  a  2  s .  c om
 *         Thrown when the initialization of the bridge failed. This is most likely due to
 *         either the connection to the knowledge base failing or the engine not properly
 *         initializing.
 */
private void instantiateSemanticSimilarityBridge() throws ExceptionInInitializerError {
    final Properties properties = PropertiesFetcher.getProperties();

    if (properties.isEmpty()) {
        throw new ExceptionInInitializerError("The properties file could not be located!"); //$NON-NLS-1$
    }

    //        semanticSimilarityBridge = new SemanticSimilarityBridge(
    //                        properties.getProperty(Externalization.ONTOLOGY_PROPERTY),
    //                        properties.getProperty(Externalization.GRAPH_PROPERTY),
    //                        properties.getProperty(Externalization.SERVER_ADDRESS_PROPERTY),
    //                        properties.getProperty(Externalization.SERVER_PASSWORD_PROPERTY),
    //                        properties.getProperty(Externalization.SERVER_PORT_PROPERTY),
    //                        properties.getProperty(Externalization.SERVER_USERNAME_PROPERTY),
    //                        properties.getProperty(Externalization.SIMILARTIY_ENGINE_TYPE_PROPERTY));
}

From source file:OpenRate.customerinterface.webservices.HibernateUtil.java

/**
 * Return the current session factory/*from   ww w .  j ava2  s  . c  o  m*/
 *
 * @return
 */
private static SessionFactory getSessionFactory(boolean useBeansList) {
    try {
        if (sessionFactory == null) {
            if (useBeansList) {
                // use the J2EE type beans list
                Configuration configuration = new Configuration();

                // load all beans
                InputStream is = HibernateUtil.class.getResourceAsStream("hibernateBeans.lst");
                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                String line;

                while ((line = reader.readLine()) != null) {
                    configuration.addResource(line);
                }

                Properties properties = new Properties();

                properties.load(HibernateUtil.class.getResourceAsStream("hibernate.properties"));
                configuration.setProperties(properties);
                sessionFactory = configuration.buildSessionFactory();
            } else {
                // Use the plain old session factory
                sessionFactory = new Configuration().configure().buildSessionFactory();
            }
        }
    } catch (Throwable ex) {
        log.error("Initial SessionFactory creation failed.", ex);

        throw new ExceptionInInitializerError(ex);
    }

    return sessionFactory;
}

From source file:io.valuesfeng.picker.Picker.java

public static Picker from(Activity activity, Set<MimeType> mimeType) {
    if (hasInitPicker)
        throw new ExceptionInInitializerError(INITIALIZE_PICKER_ERROR);
    hasInitPicker = true;//from   ww w .  j  a v a  2s. co  m
    return new Picker(activity, null, mimeType);
}

From source file:org.webical.manager.impl.CalendarManagerImpl.java

/**
 * Checks if all properties are corectly set up
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *//*from  w ww .j  ava2  s . c  o  m*/
public void afterPropertiesSet() throws Exception {
    if (calendarDao == null) {
        throw new ExceptionInInitializerError(CALENDAR_MANAGER_IMPL_NEEDS_CALENDAR_DAO);
    } else if (log.isDebugEnabled()) {
        log.debug("Class of CalendarDao set by Spring: " + calendarDao.getClass());
    }

    if (daoFactory == null) {
        throw new ExceptionInInitializerError("CalendarManagerImpl needs a DaoFactory");
    }
}

From source file:jenkins.security.stapler.StaticRoutingDecisionProvider.java

private synchronized void reloadFromDefault() {
    try (InputStream is = StaticRoutingDecisionProvider.class.getResourceAsStream("default-whitelist.txt")) {
        whitelistSignaturesFromFixedList = new HashSet<>();
        blacklistSignaturesFromFixedList = new HashSet<>();

        parseFileIntoList(IOUtils.readLines(is, StandardCharsets.UTF_8), whitelistSignaturesFromFixedList,
                blacklistSignaturesFromFixedList);
    } catch (IOException e) {
        throw new ExceptionInInitializerError(e);
    }/*from  w  ww  .ja  v a2  s. c  om*/

    LOGGER.log(Level.FINE, "Found {0} getter in the standard whitelist",
            whitelistSignaturesFromFixedList.size());
}