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:org.opensprout.osaf.propertyeditor.GenericFakePropertyEditor.java

/** id -> Fake Entity */
@Override/*from  w ww  .j  a v a 2 s  .c om*/
public void setAsText(String id) throws IllegalArgumentException {
    logger.debug("text = " + id);
    if (id == null || id.trim().length() == 0 || id.equals("0"))
        setValue(null);
    else {
        T entity;
        try {
            entity = entityClass.newInstance();
            Field idFiled = ReflectionUtils.getField(entityClass, "id");
            idFiled.setAccessible(true);
            idFiled.set(entity, Integer.parseInt(id));
            setValue(entity);
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

From source file:be.blinkt.openvpn.views.ScreenSlidePagerAdapter.java

@Override
public Fragment getItem(int position) {
    try {//from   w  w w.java  2  s  .c o  m
        Fragment fragment = mTabs.get(position).fragmentClass.newInstance();
        if (mFragmentArguments != null)
            fragment.setArguments(mFragmentArguments);
        return fragment;
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.sonoport.freesound.response.mapping.AbstractUserMapper.java

@Override
public R map(final JSONObject source) {
    R user = null;/*  ww w .  j  a v a  2 s  . com*/
    try {
        user = returnType.newInstance();

        user.setUrl(extractFieldValue(source, "url", String.class));
        user.setUsername(extractFieldValue(source, "username", String.class));
        user.setAbout(extractFieldValue(source, "about", String.class));
        user.setHomepage(extractFieldValue(source, "home_page", String.class));
        user.setAvatarURIs(parseDictionary(extractFieldValue(source, "avatar", JSONObject.class)));
        user.setDateJoined(parseDate(extractFieldValue(source, "date_joined", String.class)));
        user.setNumberOfSounds(extractFieldValue(source, "num_sounds", Integer.class));
        user.setSoundsURI(extractFieldValue(source, "sounds", String.class));
        user.setNumberOfPacks(extractFieldValue(source, "num_packs", Integer.class));
        user.setPacksURI(extractFieldValue(source, "packs", String.class));
        user.setNumberOfPosts(extractFieldValue(source, "num_posts", Integer.class));
        user.setNumberOfComments(extractFieldValue(source, "num_comments", Integer.class));
        user.setBookmarkCategoriesURI(extractFieldValue(source, "bookmark_categories", String.class));
    } catch (final InstantiationException e) {
        e.printStackTrace();
    } catch (final IllegalAccessException e) {
        e.printStackTrace();
    }

    return user;
}

From source file:corner.orm.tapestry.ReflectPrimaryKeyConverter.java

/**
 * ??Object./*from ww  w.  java  2s .  c o m*/
 * @see org.apache.tapestry.components.IPrimaryKeyConverter#getValue(java.lang.Object)
 */
public Object getValue(Object id) {
    try {
        Object obj = c.newInstance();
        BeanUtils.setProperty(obj, idStr, id);

        if (logger.isDebugEnabled()) {
            logger.debug("getValue(Object) id[" + id + "]"); //$NON-NLS-1$
        }
        return obj;
    } catch (InstantiationException e) {
        e.printStackTrace();
        return null;
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        return null;
    }

}

From source file:me.henrytao.mddemo.activity.ExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_example);
    setTitle(getIntent().getStringExtra(FRAGMENT_TITLE));
    try {//from w  w  w .  ja  va 2  s. c  o  m
        Class objectClass = Class.forName(getIntent().getStringExtra(FRAGMENT_NAME));
        Constructor constructor = objectClass.getConstructor();
        Fragment fragment = (Fragment) constructor.newInstance();
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment, fragment).commit();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}

From source file:com.grottworkshop.gwsviewmodellibrary.viewcontrollers.ViewModelBaseFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {//from  w  w  w .ja va2 s  .c  o  m
        mViewModeHelper.onCreate(getActivity(), savedInstanceState, getViewModelClass());
    } catch (java.lang.InstantiationException e) {
        e.printStackTrace();
    }
}

From source file:com.lonepulse.icklebot.test.fragment.support.FragmentActivityTemplate.java

/**
 * <p>Exposes {@link #onCreate(Bundle)} and allows unit tests to 
 * invoke it from an external context. Creates an instance of the 
 * fragment to be tested commits it via the support fragment manager. 
 *//*from  w  w w .java2  s .  co m*/
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    try {

        fragment = fragmentClass.newInstance();
    } catch (InstantiationException ie) {

        ie.printStackTrace();
    } catch (IllegalAccessException iae) {

        iae.printStackTrace();
    }

    getSupportFragmentManager().beginTransaction().add(fragment, "fragment").commit();
}

From source file:com.bosong.framework.presenter.FragmentPresenter.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {/*from  w  w  w  .jav a2  s . c  o m*/
        viewDelegate = getDelegateClass().newInstance();
    } catch (java.lang.InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

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

@Override
public Fragment createPage(int position) {
    Fragment page;//from w w  w  .  j  a v a 2s .  c om
    try {
        page = (Fragment) PAGES[position].newInstance();
    } 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:com.akaashvani.akaashvani.springIndicator.PagerModelManager.java

public PagerModelManager addCommonFragment(Class<?> c, List<? extends Serializable> list) {
    try {/*from   ww  w .  j  a  v  a  2  s  .  com*/
        for (int i = 0; i < list.size(); i++) {
            Fragment fragment = (Fragment) c.newInstance();
            Bundle bundle = new Bundle();
            bundle.putSerializable(DATA, list.get(i));
            fragment.setArguments(bundle);
            fragmentList.add(fragment);
        }
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return this;
}