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:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);/*w  w  w.j av a  2  s. c  om*/

    try {
        DefaultListSelectionModel mClone = (DefaultListSelectionModel) m.clone();
    } catch (CloneNotSupportedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    add(pane, BorderLayout.NORTH);
}

From source file:org.pentaho.di.trans.steps.zendesk.ZendeskInputTicketAuditData.java

void addAudit(Audit audit) throws KettleValueException {
    if (auditSummaries == null) {
        auditSummaries = new LinkedMap<Long, ZendeskTicketAuditHistory>();
    }//from  w  ww  .  java 2  s. c  om
    if (auditSummaries.size() <= 0) {
        auditSummaries.put(audit.getId(), new ZendeskTicketAuditHistory(audit));
    } else {
        try {
            ZendeskTicketAuditHistory newAudit = auditSummaries.get(auditSummaries.lastKey())
                    .createNextAudit(audit, auditSummaries);
            auditSummaries.put(audit.getId(), newAudit);
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.wabacus.system.datatype.AbsNumberType.java

public IDataType setUserConfigString(String configstring) {
    if (configstring == null || configstring.trim().equals(""))
        return this;
    configstring = configstring.trim();/*w  w  w.ja  va 2s.  c  o m*/
    if (getAllMNumberTypeObjects().containsKey(configstring)) {
        return getAllMNumberTypeObjects().get(configstring);
    }
    AbsNumberType newNumberType = null;
    try {
        newNumberType = (AbsNumberType) super.clone();
        newNumberType.numberformat = configstring;
        getAllMNumberTypeObjects().put(configstring, newNumberType);
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    return newNumberType;
}

From source file:fr.calamus.common.db.model.RequestBuilder.java

public RequestBuilder cloneMe() {
    try {//  w w  w. ja v  a 2s.c  om
        return (RequestBuilder) this.clone();
    } catch (CloneNotSupportedException ex) {
        ex.printStackTrace();
        return null;
    }
}

From source file:org.jboss.dashboard.provider.AbstractDataProperty.java

public DataProperty cloneProperty() {
    try {//w  w  w.  j  a  v a 2 s  . com
        AbstractDataProperty clone = (AbstractDataProperty) super.clone();
        clone.setDomain(domain.cloneDomain());
        clone.setNameI18nMap(new HashMap<Locale, String>());
        Iterator it = nameI18nMap.keySet().iterator();
        while (it.hasNext()) {
            Locale locale = (Locale) it.next();
            String name = getName(locale);
            clone.setName(name, locale);
        }
        return clone;
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:org.web4thejob.setting.DefaultSetting.java

@Override
@SuppressWarnings("unchecked")
public Setting<T> clone() {
    try {/*  w ww.  j a va  2  s.c  o m*/
        return (Setting<T>) super.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        throw new RuntimeException("clone of " + toString() + " failed.");
    }
}

From source file:org.jfree.experimental.chart.annotations.junit.XYTitleAnnotationTests.java

/**
 * Confirm that cloning works./*from   w  w w.j a  v a 2s.c om*/
 */
public void testCloning() {
    TextTitle t = new TextTitle("Title");
    XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t);
    XYTitleAnnotation a2 = null;
    try {
        a2 = (XYTitleAnnotation) a1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(a1 != a2);
    assertTrue(a1.getClass() == a2.getClass());
    assertTrue(a1.equals(a2));
}

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

/**
 * Confirm that cloning works./*from  ww w. j av a  2  s  .  co  m*/
 */
public void testCloning() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = null;
    try {
        c2 = (MatrixSeriesCollection) c1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.voltdb.planner.ParsedColInfo.java

@Override
public ParsedColInfo clone() {
    ParsedColInfo col = null;/*from   w  ww . j  a va2s.co  m*/
    try {
        col = (ParsedColInfo) super.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    col.expression = (AbstractExpression) expression.clone();
    return col;
}

From source file:action.ShowTimeSeriesWithForecastAction.java

/**
* Metoda obslugujaca zdarzenie, odpowiedzialna za inicjalizacje algorytmu genetycznego
*//*w ww. j ava  2s  .  c  om*/
public void actionPerformed(ActionEvent e) {

    try {

        if (window.getSliderSelekcji().getValue() + window.getSliderKrzyzowania().getValue()
                + window.getSliderMutacji().getValue() != 100)
            throw new ParseException(
                    "Please insert correct data for Selection, Crossing and Mutation. The sum of the three has to equal 100%",
                    0);

        TimeSeries timeSeries = window.getCurrentTimeSeries();
        if (timeSeries == null || timeSeries.isEmpty())
            throw new DataLengthException();

        SlidingTimeWindow slidingTimeWindow = new SlidingTimeWindow(
                this.parseToWindowForm(window.getTimeWindowField().getText()));

        if (window.getRdBtnStochastic().isSelected())
            GASettings.getInstance()
                    .setSelectionMethod(SelectionMethod.STOCHASTIC_UNIVERSAL_SAMPLING_SELECTION);

        if (window.getRdbtnArmaForecast().isSelected())
            GASettings.getInstance().setForecastMethod(ForecastMethod.ARMA_FORECAST);

        GASettings.getInstance().setConcurrent(true);

        ApplicationContext context = new AnnotationConfigApplicationContext(ForecastConfig.class);
        AbstractForecast forecast = (AbstractForecast) context.getBean("forecast");

        forecast.initializeGeneticAlgorithm((TimeSeries) timeSeries.clone(),
                (Integer) window.getPopulSizeField().getValue(), slidingTimeWindow,
                (Integer) window.getIterNumberField().getValue(),
                (double) window.getSliderProbOfCross().getValue() / 100,
                (double) window.getSliderProbOfMutat().getValue() / 100,
                (double) window.getSliderSelekcji().getValue() / 100,
                (double) window.getSliderKrzyzowania().getValue() / 100,
                (double) window.getSliderMutacji().getValue() / 100);
        forecast.initializeForecast((Integer) window.getPeriodOfPredField().getValue());

        forecast.addObserver(new GAChartObserver(window.getFitnessChart(),
                window.getTimeSeriesChartWithForecast(), (Integer) window.getPeriodOfPredField().getValue()));
        forecast.addObserver(new GAStatisticObserver(window.getForecast(),
                (Integer) window.getPeriodOfPredField().getValue()));
        forecast.execute();
        window.getTabbedPane().setSelectedIndex(3);

    } catch (CloneNotSupportedException e1) {
        e1.printStackTrace();
    } catch (DataLengthException de) {
        JOptionPane.showMessageDialog(window, "Current data is not set or empty", "Error",
                JOptionPane.ERROR_MESSAGE);
    } catch (ParseException pe) {
        JOptionPane.showMessageDialog(window, pe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    } catch (Exception exc) {
        JOptionPane.showMessageDialog(window, "Wrong data", "Error", JOptionPane.ERROR_MESSAGE);
    }
}