Example usage for java.lang CloneNotSupportedException printStackTrace

List of usage examples for java.lang CloneNotSupportedException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:tajo.engine.parser.QueryAnalyzer.java

/**
 * determine a column by finding tables which are given by 'from clause'.
 *
 * @param tree/*from   ww w  .  j  a v  a 2 s . c om*/
 * @param columnName field name to be find
 * @return a found column
 */
private Column expectTableByField(final PlanningContext context, final ParseTree tree, String columnName) {
    TableDesc desc;
    Schema schema;
    Column column = null;
    int count = 0;
    for (String table : tree.getAllTableNames()) {
        desc = catalog.getTableDesc(table);
        schema = desc.getMeta().getSchema();

        if (schema.contains(table + "." + columnName)) {
            column = schema.getColumn(table + "." + columnName);
            count++;
        }

        if (tree instanceof QueryBlock) {
            QueryBlock block = ((QueryBlock) tree);
            if (block.getTargetList() != null) {
                for (Target target : block.getTargetList()) {
                    if (target.hasAlias() && target.getAlias().equals(columnName)) {
                        try {
                            column = (Column) target.getColumnSchema().clone();
                            column.setName(target.getAlias());
                        } catch (CloneNotSupportedException e) {
                            e.printStackTrace();
                        }
                        count++;
                    }
                }
            }
        }

        // if there are more than one column, we cannot expect
        // that this column belongs to which table.
        if (count > 1)
            throw new AmbiguousFieldException(columnName);
    }

    if (column == null) { // if there are no matched column
        throw new InvalidQueryException("ERROR: column \"" + columnName + "\" does not exist");
    }

    return column;
}

From source file:org.apache.tajo.engine.parser.QueryAnalyzer.java

/**
 * determine a column by finding tables which are given by 'from clause'.
 *
 * @param tree/*ww  w.  jav  a 2 s . co  m*/
 * @param columnName field name to be find
 * @return a found column
 */
private Column expectTableByField(final PlanningContext context, final ParseTree tree, String columnName) {
    TableDesc desc;
    Schema schema;
    Column column = null;
    int count = 0;

    // find a column corresponding to the given column name from tables of the catalog
    for (String table : tree.getAllTableNames()) {
        desc = catalog.getTableDesc(table);
        schema = desc.getMeta().getSchema();

        if (schema.contains(table + "." + columnName)) {
            column = schema.getColumn(table + "." + columnName);
            count++;
        }
    }

    // find a column corresponding to the given column name from the target list
    if (tree instanceof QueryBlock) {
        QueryBlock block = ((QueryBlock) tree);
        if (block.getTargetList() != null) {
            for (Target target : block.getTargetList()) {
                if (target.hasAlias() && target.getAlias().equals(columnName)) {
                    try {
                        column = (Column) target.getColumnSchema().clone();
                        column.setName(target.getAlias());
                    } catch (CloneNotSupportedException e) {
                        e.printStackTrace();
                    }
                    count++;
                }
            }
        }
    }

    // if there are more than one column, we cannot exactly expect
    // that this column belongs to which table.
    if (count > 1)
        throw new AmbiguousFieldException(columnName);

    if (column == null) { // if there are no matched column
        throw new InvalidQueryException("ERROR: column \"" + columnName + "\" does not exist");
    }

    return column;
}

From source file:pcgen.core.PCClass.java

public void copyLevelsFrom(PCClass cl) {
    for (Map.Entry<Integer, PCClassLevel> me : cl.levelMap.entrySet()) {
        try {/*from   w w w  . j  a  v a 2  s .c  o m*/
            PCClassLevel lvl = me.getValue().clone();
            lvl.put(StringKey.QUALIFIED_KEY, getQualifiedKey());
            lvl.put(ObjectKey.SOURCE_CAMPAIGN, get(ObjectKey.SOURCE_CAMPAIGN));
            lvl.put(StringKey.SOURCE_PAGE, get(StringKey.SOURCE_PAGE));
            lvl.put(StringKey.SOURCE_LONG, get(StringKey.SOURCE_LONG));
            lvl.put(StringKey.SOURCE_SHORT, get(StringKey.SOURCE_SHORT));
            lvl.put(StringKey.SOURCE_WEB, get(StringKey.SOURCE_WEB));
            lvl.put(ObjectKey.SOURCE_DATE, get(ObjectKey.SOURCE_DATE));
            lvl.put(ObjectKey.TOKEN_PARENT, this);
            lvl.setName(getDisplayName() + "(" + lvl.get(IntegerKey.LEVEL) + ")");
            lvl.ownBonuses(this);
            levelMap.put(me.getKey(), lvl);
        } catch (CloneNotSupportedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:pcgen.core.PCClass.java

public void inheritAttributesFrom(final PCClass otherClass) {
    Boolean hbss = otherClass.get(ObjectKey.HAS_BONUS_SPELL_STAT);
    if (hbss != null) {
        put(ObjectKey.HAS_BONUS_SPELL_STAT, hbss);
        CDOMSingleRef<PCStat> bss = otherClass.get(ObjectKey.BONUS_SPELL_STAT);
        if (bss != null) {
            put(ObjectKey.BONUS_SPELL_STAT, bss);
        }/*from ww  w  .java 2  s .  c  om*/
    }

    Boolean usbs = otherClass.get(ObjectKey.USE_SPELL_SPELL_STAT);
    if (usbs != null) {
        put(ObjectKey.USE_SPELL_SPELL_STAT, usbs);
    }
    Boolean cwss = otherClass.get(ObjectKey.CASTER_WITHOUT_SPELL_STAT);
    if (cwss != null) {
        put(ObjectKey.CASTER_WITHOUT_SPELL_STAT, cwss);
    }
    CDOMSingleRef<PCStat> ss = otherClass.get(ObjectKey.SPELL_STAT);
    if (ss != null) {
        put(ObjectKey.SPELL_STAT, ss);
    }

    TransitionChoice<CDOMListObject<Spell>> slc = otherClass.get(ObjectKey.SPELLLIST_CHOICE);
    if (slc != null) {
        put(ObjectKey.SPELLLIST_CHOICE, slc);
    }

    List<QualifiedObject<CDOMReference<Equipment>>> e = otherClass.getListFor(ListKey.EQUIPMENT);
    if (e != null) {
        addAllToListFor(ListKey.EQUIPMENT, e);
    }

    List<WeaponProfProvider> wp = otherClass.getListFor(ListKey.WEAPONPROF);
    if (wp != null) {
        addAllToListFor(ListKey.WEAPONPROF, wp);
    }
    QualifiedObject<Boolean> otherWP = otherClass.get(ObjectKey.HAS_DEITY_WEAPONPROF);
    if (otherWP != null) {
        put(ObjectKey.HAS_DEITY_WEAPONPROF, otherWP);
    }

    List<ArmorProfProvider> ap = otherClass.getListFor(ListKey.AUTO_ARMORPROF);
    if (ap != null) {
        addAllToListFor(ListKey.AUTO_ARMORPROF, ap);
    }

    List<ShieldProfProvider> sp = otherClass.getListFor(ListKey.AUTO_SHIELDPROF);
    if (sp != null) {
        addAllToListFor(ListKey.AUTO_SHIELDPROF, sp);
    }

    List<BonusObj> bonusList = otherClass.getListFor(ListKey.BONUS);
    if (bonusList != null) {
        addAllToListFor(ListKey.BONUS, bonusList);
    }
    try {
        ownBonuses(this);
    } catch (CloneNotSupportedException ce) {
        // TODO Auto-generated catch block
        ce.printStackTrace();
    }

    for (VariableKey vk : otherClass.getVariableKeys()) {
        put(vk, otherClass.get(vk));
    }

    if (otherClass.containsListFor(ListKey.CSKILL)) {
        removeListFor(ListKey.CSKILL);
        addAllToListFor(ListKey.CSKILL, otherClass.getListFor(ListKey.CSKILL));
    }

    if (otherClass.containsListFor(ListKey.LOCALCCSKILL)) {
        removeListFor(ListKey.LOCALCCSKILL);
        addAllToListFor(ListKey.LOCALCCSKILL, otherClass.getListFor(ListKey.LOCALCCSKILL));
    }

    removeListFor(ListKey.KIT_CHOICE);
    addAllToListFor(ListKey.KIT_CHOICE, otherClass.getSafeListFor(ListKey.KIT_CHOICE));

    remove(ObjectKey.REGION_CHOICE);
    if (otherClass.containsKey(ObjectKey.REGION_CHOICE)) {
        put(ObjectKey.REGION_CHOICE, otherClass.get(ObjectKey.REGION_CHOICE));
    }

    removeListFor(ListKey.SAB);
    addAllToListFor(ListKey.SAB, otherClass.getSafeListFor(ListKey.SAB));

    /*
     * TODO Does this need to have things from the Class Level objects?
     * I don't think so based on deferred processing of levels...
     */

    addAllToListFor(ListKey.DAMAGE_REDUCTION, otherClass.getListFor(ListKey.DAMAGE_REDUCTION));

    for (CDOMReference<Vision> ref : otherClass.getSafeListMods(Vision.VISIONLIST)) {
        for (AssociatedPrereqObject apo : otherClass.getListAssociations(Vision.VISIONLIST, ref)) {
            putToList(Vision.VISIONLIST, ref, apo);
        }
    }

    /*
     * TODO This is a clone problem, but works for now - thpr 10/3/08
     */
    if (otherClass instanceof SubClass) {
        levelMap.clear();
        copyLevelsFrom(otherClass);
    }

    addAllToListFor(ListKey.NATURAL_WEAPON, otherClass.getListFor(ListKey.NATURAL_WEAPON));

    put(ObjectKey.LEVEL_HITDIE, otherClass.get(ObjectKey.LEVEL_HITDIE));
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

private void editAccessGroup() {
    Bundle bundle = new Bundle();
    try {//from   www .  j av a 2  s  .c o m
        bundle.putSerializable(User.TAG, mUserInfo.clone());
        bundle.putSerializable(Setting.DISABLE_MODIFY, false);
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    mScreenControl.addScreen(ScreenType.USER_ACCESS_GROUP, bundle);
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

private void editCard() {
    Bundle bundle = new Bundle();
    try {/*from  ww  w  .j  a va  2  s. c  o  m*/
        bundle.putSerializable(User.TAG, mUserInfo.clone());
        bundle.putSerializable(Setting.DISABLE_MODIFY, false);
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    mScreenControl.addScreen(ScreenType.CARD_RIGISTER, bundle);
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

private void editFingerPrint() {
    Bundle bundle = new Bundle();
    try {//from  ww w. jav  a2  s .com
        bundle.putSerializable(User.TAG, mUserInfo.clone());
        bundle.putSerializable(Setting.DISABLE_MODIFY, false);
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    mScreenControl.addScreen(ScreenType.FINGERPRINT_REGISTER, bundle);
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

private void editOperator() {
    Bundle bundle = new Bundle();
    try {/*from www . ja  v a2 s  .co m*/
        bundle.putSerializable(User.TAG, mUserInfo.clone());
        bundle.putSerializable(Setting.DISABLE_MODIFY, false);
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    mScreenControl.addScreen(ScreenType.USER_PERMISSION, bundle);
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

private void showUserViewLog() {
    User bundleItem = null;/* w w  w  . ja  v a  2 s  .  c o m*/
    try {
        bundleItem = (User) mUserInfo.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    Bundle bundle = new Bundle();
    bundle.putSerializable(User.TAG, bundleItem);
    mScreenControl.addScreen(ScreenType.MONITOR, bundle);
}

From source file:com.supremainc.biostar2.user.UserModifyFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Log.e(TAG, "onSaveInstanceState");
    User bundleItem = null;//from www .  ja  v  a2  s  . co m
    try {
        bundleItem = (User) mUserInfo.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    outState.putSerializable(User.TAG, bundleItem);
    outState.putInt("photoStatus", mPhotoStatus.ordinal());
    outState.putBoolean("newUser", mIsNewUser);
}