Example usage for java.lang InstantiationException printStackTrace

List of usage examples for java.lang InstantiationException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.samelody.puppetry.PresenterDelegateImpl.java

@Override
public P createPresenterAndModel() {
    String implName = presenterProxy.getTargetInterface().getName().replace("Contract$", "");
    try {//from w  ww. j av  a 2  s  . co m
        AbstractPresenter presenter = (AbstractPresenter) Class.forName(implName).newInstance();
        presenter.createModel();
        return (P) presenter;
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:org.blockartistry.mod.ThermalRecycling.support.SupportedMod.java

public ModPlugin getPlugin() {
    try {//w  w w. j av  a2s.co  m
        if (pluginFactory == SimplePlugin.class)
            return new SimplePlugin(this);
        return pluginFactory.newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:blue.orchestra.blueSynthBuilder.BSBCloneTest.java

public void testSerialize() {
    BSBObjectEntry[] bsbObjects = BSBObjectRegistry.getBSBObjects();

    for (int i = 0; i < bsbObjects.length; i++) {
        BSBObjectEntry entry = bsbObjects[i];

        Class class1 = entry.bsbObjectClass;

        BSBObject bsbObj = null;/*w ww  . j  a va  2 s  .  c  o m*/

        try {
            bsbObj = (BSBObject) class1.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        assertNotNull(bsbObj);

        if (bsbObj == null) {
            continue;
        }

        Object obj = ObjectUtilities.clone(bsbObj);
        assertNotNull(obj);
    }

}

From source file:me.henrytao.observableorm.orm.ObservableModel.java

public ObservableModel() {
    setObservableAdapter(mListAdapterClass);
    for (Class adapterClass : mListAdapterClass) {
        // todo: need to think about handling exception
        try {//from   ww w  .j  a v a2 s.com
            mListAdapter.add((ObservableAdapter) adapterClass.newInstance());
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.guestbook.service.GuestbookManager.java

@SuppressWarnings("rawtypes")
private HibernateDaoSupport get(Class clazz) {
    // Retrieve the specified manager/dao
    HibernateDaoSupport manager = managerMap.get(clazz);

    if (manager == null) {
        try {/*from  w w w  .j  ava 2 s.com*/
            manager = (HibernateDaoSupport) Class.forName(clazz.getName()).newInstance();
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // Pass the Hibernate SesssionFactory in. This is all the "wiring up" we need!
        manager.setSessionFactory(sessionFactory);

        // Store it so we can reuse it on subsequent calls.
        managerMap.put(clazz, manager);
    }
    return manager;
}

From source file:com.fenlisproject.elf.core.base.BaseActivity.java

public void replaceFragment(int layoutId, Class FragmentClass) {
    try {//from  w  w w. j a v a  2  s.  c  om
        Fragment fragment = (Fragment) FragmentClass.newInstance();
        replaceFragment(layoutId, fragment);
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:com.fenlisproject.elf.core.base.BaseActivity.java

public void replaceFragment(int layoutId, Class FragmentClass, int enterAnim, int exitAnim) {
    try {/*from  w  w  w.jav a  2s  .com*/
        Fragment fragment = (Fragment) FragmentClass.newInstance();
        replaceFragment(layoutId, fragment, enterAnim, exitAnim);
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:br.com.pfood.mb.imp.GenericMBImp.java

@Override
public void init(GenericBO bo) {
    try {//  w  w  w .j av  a 2 s .  c o  m
        ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
        classe = (Class) parameterizedType.getActualTypeArguments()[0];
        obj = classe.newInstance();
        lista = new ArrayList<T>();
        this.genericBO = bo;
        this.beanManager = new CdiUtils().getBeanManager();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    }
}

From source file:keel.Algorithms.Neural_Networks.NNEP_Common.NeuralNetCreator.java

/**
 * <p>/* ww w  .j  a v a  2 s. c  om*/
 * Prepares the creation initiators
 * </p>
 */
protected void prepareCreation() {
    ISpecies<I> spc = context.getSpecies();
    if (spc instanceof INeuralNetSpecies) {
        // Sets individual species
        this.species = (INeuralNetSpecies<I>) spc;
    } else
        throw new IllegalStateException("Illegal species in context");

    // Generate the initiators of layers of neural nets
    initiators = new IInitiator[species.getNOfHiddenLayers() + 1];
    try {
        //Each hidden Layer initiator
        for (int i = 0; i < species.getNOfHiddenLayers(); i++) {
            initiators[i] = (IInitiator) Class.forName(species.getHiddenLayerInitiator(i)).newInstance();
            initiators[i].contextualize(context);
        }

        //Output Layer initiator
        initiators[species.getNOfHiddenLayers()] = (IInitiator) Class.forName(species.getOutputLayerInitiator())
                .newInstance();
        initiators[species.getNOfHiddenLayers()].contextualize(context);

    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }

}

From source file:com.xiovr.unibot.plugin.impl.PluginLoaderImpl.java

@SuppressWarnings("unchecked")
@Override//from   www . j a va  2 s  .co  m
public ScriptPlugin createScriptPlugin(String fileName) throws RuntimeException {
    ScriptPlugin sp = null;
    File file = new File(fileName);
    Class<ScriptPlugin> clazz;

    if (file.isFile() && file.getName().endsWith(".jar")) {
        clazz = (Class<ScriptPlugin>) loadClass(file, SCRIPT_PARAM_CLASS_NAME);
        if (clazz == null) {
            throw new RuntimeException("Can't find ScriptPlugin class");
        }
    } else {
        throw new RuntimeException("Can't load script " + fileName);
    }

    try {
        sp = (ScriptPlugin) clazz.newInstance();
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return sp;
}