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.bosong.framework.presenter.FragmentPresenter.java

@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (viewDelegate == null) {
        try {//from w ww.j  a va2 s  . com
            viewDelegate = getDelegateClass().newInstance();
        } catch (java.lang.InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.medvid.andriy.housemanager.multiplemodel.viewpager.PagerManager.java

public PagerManager addFragments(List<ItemEntity> dataList) {
    try {/*w ww  .  j  a va  2  s . c  om*/
        for (ItemEntity itemEntity : dataList) {
            Fragment fragment = (Fragment) itemEntity.getModelView().newInstance();
            Bundle bundle = new Bundle();
            bundle.putSerializable(DATA, itemEntity);
            fragment.setArguments(bundle);
            fragmentList.add(fragment);
        }
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return this;
}

From source file:es.udc.gii.common.eaf.config.EAFConfiguration.java

public Object getObject(String parameter) {

    Object object = null;//from  w  w w  .j  a  va 2  s.c o m
    try {

        object = Class.forName(this.getString(parameter)).newInstance();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    }

    return object;

}

From source file:com.pdi.hybridge.HybridgeWebChromeClient.java

@SuppressLint("DefaultLocale")
@SuppressWarnings({ "unchecked", "rawtypes" })
private void executeJSONTask(String action, JSONObject json, JsPromptResult result,
        HybridgeBroadcaster hybridge, Activity activity) {
    final Class clazz = mActions.get(action);
    if (clazz != null && hybridge != null) {
        AsyncTask task = null;/* ww  w.  jav  a2  s. c om*/
        try {
            task = (AsyncTask<JSONObject, Void, JSONObject>) clazz
                    .getDeclaredConstructor(new Class[] { android.app.Activity.class }).newInstance(activity);
        } catch (final InstantiationException e) {
            e.printStackTrace();
        } catch (final IllegalAccessException e) {
            e.printStackTrace();
        } catch (final IllegalArgumentException e) {
            e.printStackTrace();
        } catch (final InvocationTargetException e) {
            e.printStackTrace();
        } catch (final NoSuchMethodException e) {
            e.printStackTrace();
        }
        Log.v(mTag, "Execute action " + action);
        task.execute(json, result, hybridge);
    } else {
        result.confirm(json.toString());
        Log.d(mTag, "Hybridge action not implemented: " + action);
    }
}

From source file:com.textocat.textokit.corpus.statistics.cpe.UnitsDAOWriter.java

@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
    super.initialize(context);
    try {/*from  w  w  w.ja va 2s  .com*/
        unitsDAO = (UnitsDAO) Class.forName(unitsDAOImplementationClassName).newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:com.liyanju.commonlibs.themvp.presenter.FragmentPresenter.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {/*  ww w .j a v  a  2  s.  c o  m*/
        viewDelegate = getDelegateClass().newInstance();
        if (viewDelegate instanceof AppDelegate) {
            ((AppDelegate) viewDelegate).setFragment(this);
        }
    } catch (java.lang.InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.webguitoolkit.ui.controls.util.conversion.CollectionConverter.java

/**
 * @see org.webguitoolkit.ui.controls.util.conversion.IConverter#parse(java.lang.String)
 */// ww w. j  a  v  a2 s .  c o m
public Object parse(String textRep) throws ConversionException {
    try {
        Collection col = (Collection) collectionClass.newInstance();
        String[] values = textRep.split(getDelim());
        for (int i = 0; i < values.length; i++) {
            col.add(itemConverter.parse(values[i]));
        }
        return col;
    } catch (InstantiationException e) {
        e.printStackTrace();
        throw new ConversionException("Collection class could not be instanciated: ", e);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        throw new ConversionException("No public default constructor: ", e);
    }
}

From source file:com.google.wave.api.impl.ElementSerializer.java

@Override
public Object unmarshall(SerializerState state, Class clazz, Object json) throws UnmarshallException {
    if (!Element.class.isAssignableFrom(clazz)) {
        throw new UnmarshallException(clazz.getName() + " is not assignable from Element");
    }/*w w  w. j av a 2  s .c o  m*/

    JSONObject jsonObject = (JSONObject) json;
    Element element = null;
    try {
        String javaname = jsonObject.isNull("name") ? "" : jsonObject.getString("name");
        element = (Element) clazz.newInstance();
        element.setType(ElementType.valueOf(jsonObject.getString("type")));
        element.setProperties(
                (Map<String, Object>) ser.unmarshall(state, Map.class, jsonObject.getJSONObject("properties")));

    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (JSONException jsonx) {
        jsonx.printStackTrace();
    }

    return element;
}

From source file:org.deviceconnect.android.deviceplugin.fplug.setting.SettingActivity.java

@Override
public Fragment createPage(final int position) {
    Fragment page;/*from   w w  w. j  a  v a 2s .  co m*/
    try {
        page = (Fragment) PAGES[position].newInstance();
        if (page instanceof FPLUGControllerFragment) {
            mControllFragment = (FPLUGControllerFragment) page;
        }
    } catch (InstantiationException e) {
        if (BuildConfig.DEBUG) {
            e.printStackTrace();
        }
        page = null;
    } catch (IllegalAccessException e) {
        if (BuildConfig.DEBUG) {
            e.printStackTrace();
        }
        page = null;
    }
    return page;
}

From source file:net.i2cat.netconf.transport.TransportFactory.java

/**
 * Return an instance of the transport associated with <code>scheme</code>. You must register transports with
 * <code>registerTransport(scheme, transportClass)</code> before getting instances here.
 *
 * @param scheme the scheme associated with the transport class to instantiate.
 * @return an instance of the Transport associated with <code>scheme</code>. Returns <code>null</code> if the transport
 * cannot be instantiated (if, for example, the registered transport class was abstract).
 * @throws TransportNotRegisteredException thrown if no transport class has been registered for <code>scheme</code>.
 *//*ww w.j a  va2 s .c  o  m*/
public Transport getTransport(String scheme) throws TransportNotRegisteredException {

    if (!registeredTransports.containsKey(scheme)) {
        throw new TransportNotRegisteredException("Unknown transport: " + scheme);
    }

    try {
        return (Transport) registeredTransports.get(scheme).newInstance();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    return null;
}