Example usage for java.lang CloneNotSupportedException getMessage

List of usage examples for java.lang CloneNotSupportedException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:pcgen.core.PCClass.java

@Override
public PCClass clone() {
    PCClass aClass = null;// w  w  w .  j a  v a  2s  .c o m

    try {
        aClass = (PCClass) super.clone();

        List<KnownSpellIdentifier> ksl = getListFor(ListKey.KNOWN_SPELLS);
        if (ksl != null) {
            aClass.removeListFor(ListKey.KNOWN_SPELLS);
            for (KnownSpellIdentifier ksi : ksl) {
                aClass.addToListFor(ListKey.KNOWN_SPELLS, ksi);
            }
        }
        Map<AttackType, Integer> acmap = getMapFor(MapKey.ATTACK_CYCLE);
        if (acmap != null && !acmap.isEmpty()) {
            aClass.removeMapFor(MapKey.ATTACK_CYCLE);
            for (Map.Entry<AttackType, Integer> me : acmap.entrySet()) {
                aClass.addToMapFor(MapKey.ATTACK_CYCLE, me.getKey(), me.getValue());
            }
        }

        aClass.levelMap = new TreeMap<>();
        for (Map.Entry<Integer, PCClassLevel> me : levelMap.entrySet()) {
            aClass.levelMap.put(me.getKey(), me.getValue().clone());
        }
    } catch (CloneNotSupportedException exc) {
        ShowMessageDelegate.showMessageDialog(exc.getMessage(), Constants.APPLICATION_NAME, MessageType.ERROR);
    }

    return aClass;
}

From source file:velo.entity.Resource.java

@Override
public Resource clone() {
    try {//from   ww w  .  j av a  2  s . c om
        Resource clonedEntity = (Resource) super.clone();

        // TODO: SHOULD CLONE ALL REFERENCES!

        return clonedEntity;
    } catch (CloneNotSupportedException cnfe) {
        System.out.println("Couldnt clone class: " + this.getClass().getName() + ", with exception message: "
                + cnfe.getMessage());
        return null;
    }
}

From source file:wsattacker.library.intelligentdos.IntelligentDoSLibraryImpl.java

private AttackModel createAttack(RequestType requestType, CommonParamItem commonParams, boolean needRecovery) {
    AttackModel attackModel = new AttackModel();
    attackModel.setRequestType(requestType);

    try {/*from ww w.j a v a  2  s .  c  o  m*/
        // Clone the dos attack, else we manipulate the "original" and cannot save the state
        attackModel.setDoSAttack(currentDoSAttack.clone());
    } catch (CloneNotSupportedException e) {
        LOG.info(e.getMessage(), e);
    }

    attackModel.setParamItem(commonParams);

    if (needRecovery) {
        attackModel.setServerRecoveryBeforeSend(serverRecovery);
    }

    return attackModel;
}