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:org.aliuge.crawler.url.WebURL.java

@Override
public Object clone() {
    WebURL o = null;/* ww w . j av  a  2s.c o m*/
    try {
        o = (WebURL) super.clone();
    } catch (CloneNotSupportedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return o;
}

From source file:org.jfree.data.xy.junit.DefaultXYDatasetTest.java

/**
 * Confirm that cloning works.//  ww  w . j  av a2 s  .co  m
 */
public void testCloning() {
    DefaultXYDataset d1 = new DefaultXYDataset();
    DefaultXYDataset d2 = null;
    try {
        d2 = (DefaultXYDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // try a dataset with some content...
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[][] data1 = new double[][] { x1, y1 };
    d1.addSeries("S1", data1);
    try {
        d2 = (DefaultXYDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that the clone doesn't share the same underlying arrays.
    x1[1] = 2.2;
    assertFalse(d1.equals(d2));
    x1[1] = 2.0;
    assertTrue(d1.equals(d2));
}

From source file:org.jfree.data.xy.junit.DefaultXYZDatasetTest.java

/**
 * Confirm that cloning works./*from  w w  w  . j  a  va 2  s  . c  om*/
 */
public void testCloning() {
    DefaultXYZDataset d1 = new DefaultXYZDataset();
    DefaultXYZDataset d2 = null;
    try {
        d2 = (DefaultXYZDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // try a dataset with some content...
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[] z1 = new double[] { 7.0, 8.0, 9.0 };
    double[][] data1 = new double[][] { x1, y1, z1 };
    d1.addSeries("S1", data1);
    try {
        d2 = (DefaultXYZDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that the clone doesn't share the same underlying arrays.
    x1[1] = 2.2;
    assertFalse(d1.equals(d2));
    x1[1] = 2.0;
    assertTrue(d1.equals(d2));
}

From source file:org.linagora.linshare.core.facade.webservice.admin.impl.MailContentFacadeImpl.java

private MailConfig getFakeConfig(String mailConfigUuid, User actor) {
    MailConfig config = findMailConfig(mailConfigUuid, actor);
    try {/*  w  w w  .j  a va 2 s.c o  m*/
        return config.clone();
    } catch (CloneNotSupportedException e) {
        logger.error(e.getMessage(), e);
        e.printStackTrace();
        throw new BusinessException("unexpected error");
    }
}

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

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Log.e(TAG, "onSaveInstanceState");
    User bundleItem = null;/* w w  w .jav a  2 s .  c om*/
    try {
        bundleItem = (User) mUserInfo.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return;
    }
    outState.putSerializable(User.TAG, bundleItem);
}

From source file:com.sample.domain.entities.anagrafica.Contratto.java

@Override
public Contratto clone() {
    Contratto clonedInstance = null;//ww w.j a  va 2s  .c  o m
    try {
        clonedInstance = (Contratto) super.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    return clonedInstance;
}

From source file:org.pentaho.pms.ui.concept.editor.AbstractPropertyEditorWidget.java

protected void overridePressed() {
    if (null != conceptModel.getProperty(propertyId, IConceptModel.REL_THIS)) {
        boolean delete = MessageDialog.openConfirm(getShell(), "Confirm",
                "Are you sure you want to stop overriding the property '"
                        + PredefinedVsCustomPropertyHelper.getDescription(propertyId) + "'?");
        if (delete) {
            // no need to update override button selection status; concept mod event will do that
            conceptModel.removeProperty(propertyId);
        }/*from   www.j  a va  2 s .co  m*/
    } else {
        ConceptPropertyInterface effectiveProperty = conceptModel.getEffectiveProperty(propertyId);
        try {
            ConceptPropertyInterface clonedProperty = (ConceptPropertyInterface) effectiveProperty.clone();
            clonedProperty.setRequired(false);
            conceptModel.setProperty(clonedProperty);
            //        conceptModel.setProperty((ConceptPropertyInterface)PredefinedVsCustomPropertyHelper.createEmptyProperty(propertyId, effectiveProperty
            //            .getType()).clone());
        } catch (CloneNotSupportedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:cern.c2mon.shared.common.datatag.address.impl.HardwareAddressImpl.java

@Override
public HardwareAddressImpl clone() {
    try {/*from  w  w w.ja  va  2  s . c o  m*/
        return (HardwareAddressImpl) super.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        throw new RuntimeException("Exception caught while cloning a HardwareAddress", e);
    }
}

From source file:com.athena.meerkat.controller.web.tomcat.services.TomcatInstanceService.java

public DomainTomcatConfiguration getTomcatConfig(int domainId, int instanceId) {

    LOGGER.debug("domainId : {}, instanceId: {}", domainId, instanceId);

    DomainTomcatConfiguration conf = domainService.getTomcatConfig(domainId);
    DomainTomcatConfiguration clonedConf = null;
    try {/*from  w  ww .ja v  a  2s .c o m*/
        if (conf == null) {
            LOGGER.debug("DomainTomcatConfiguration is null of domainId({})", domainId);
            return null;
        }
        clonedConf = conf.clone();
    } catch (CloneNotSupportedException e1) {
        e1.printStackTrace();
    }

    // get configurations that are different to domain tomcat config
    List<TomcatInstConfig> changedConfigs = getTomcatInstConfigs(instanceId);
    if (changedConfigs != null) {
        for (TomcatInstConfig changedConf : changedConfigs) {
            try {
                BeanUtils.setProperty(clonedConf, changedConf.getConfigName(), changedConf.getConfigValue());
            } catch (Exception e) {
                LOGGER.error(e.toString(), e);
                throw new RuntimeException(e);
            }
        }
    }

    clonedConf.setTomcatInstanceId(instanceId);

    return clonedConf;

}

From source file:com.wabacus.config.print.AbsPrintProviderConfigBean.java

public Object clone() {
    try {/* w  ww .  j a va 2s .  c  om*/
        return super.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return null;
    }
}