List of usage examples for java.lang CloneNotSupportedException printStackTrace
public void printStackTrace()
From source file:org.jfree.data.xy.junit.XYIntervalSeriesCollectionTest.java
/** * Confirm that cloning works./*from ww w. j av a2 s.c o m*/ */ public void testCloning() { XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5); XYIntervalSeriesCollection c2 = null; try { c2 = (XYIntervalSeriesCollection) c1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(c1 != c2); assertTrue(c1.getClass() == c2.getClass()); assertTrue(c1.equals(c2)); // check independence c1.addSeries(new XYIntervalSeries("Empty")); assertFalse(c1.equals(c2)); c2.addSeries(new XYIntervalSeries("Empty")); assertTrue(c1.equals(c2)); }
From source file:com.eryansky.common.orm.entity.BaseEntity.java
public BaseEntity clone() { BaseEntity o = null;//from w ww .j ava 2s . c o m try { o = (BaseEntity) super.clone();// Objectclone()?? } catch (CloneNotSupportedException e) { e.printStackTrace(); } return o; }
From source file:org.kalypso.ui.editor.styleeditor.rule.RuleComposite.java
private Filter cloneFilter(final Filter oldFilter) { try {/*from w ww .ja v a 2 s . c om*/ if (oldFilter == null) return null; return oldFilter.clone(); } catch (final CloneNotSupportedException e) { e.printStackTrace(); return null; } }
From source file:org.jfree.data.xy.junit.DefaultTableXYDatasetTest.java
/** * Confirm that cloning works.//from w w w . j a v a 2 s . c o m */ public void testCloning() { DefaultTableXYDataset d1 = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(1.0, 1.1); s1.add(2.0, 2.2); d1.addSeries(s1); DefaultTableXYDataset d2 = null; try { d2 = (DefaultTableXYDataset) d1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); s1.add(3.0, 3.3); assertFalse(d1.equals(d2)); }
From source file:org.jfree.data.xy.junit.CategoryTableXYDatasetTest.java
/** * Confirm that cloning works./*from ww w .j a v a2 s .c o m*/ */ public void testCloning() { CategoryTableXYDataset d1 = new CategoryTableXYDataset(); d1.add(1.0, 1.1, "Series 1"); d1.add(2.0, 2.2, "Series 1"); CategoryTableXYDataset d2 = null; try { d2 = (CategoryTableXYDataset) d1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); d1.add(3.0, 3.3, "Series 1"); assertFalse(d1.equals(d2)); d2.add(3.0, 3.3, "Series 1"); assertTrue(d1.equals(d2)); d1.setIntervalPositionFactor(0.33); assertFalse(d1.equals(d2)); d2.setIntervalPositionFactor(0.33); assertTrue(d1.equals(d2)); }
From source file:org.jfree.data.xy.junit.DefaultWindDatasetTest.java
/** * Confirm that cloning works.//from w w w . ja v a 2s .com */ public void testCloning() { DefaultWindDataset d1 = new DefaultWindDataset(); DefaultWindDataset d2 = null; try { d2 = (DefaultWindDataset) 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... d1 = createSampleDataset1(); d2 = null; try { d2 = (DefaultWindDataset) d1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); }
From source file:org.jfree.data.xy.junit.CategoryTableXYDatasetTest.java
/** * Another check for cloning - making sure it works for a customised * interval delegate.//from w w w . j av a 2 s . c o m */ public void testCloning2() { CategoryTableXYDataset d1 = new CategoryTableXYDataset(); d1.add(1.0, 1.1, "Series 1"); d1.add(2.0, 2.2, "Series 1"); d1.setIntervalWidth(1.23); CategoryTableXYDataset d2 = null; try { d2 = (CategoryTableXYDataset) d1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); d1.add(3.0, 3.3, "Series 1"); assertFalse(d1.equals(d2)); d2.add(3.0, 3.3, "Series 1"); assertTrue(d1.equals(d2)); d1.setIntervalPositionFactor(0.33); assertFalse(d1.equals(d2)); d2.setIntervalPositionFactor(0.33); assertTrue(d1.equals(d2)); }
From source file:org.jfree.data.time.TimeSeriesDataItem.java
/** * Clones the data item. Note: there is no need to clone the period or * value since they are immutable classes. * * @return A clone of the data item.//from ww w .ja v a 2 s. c o m */ @Override public Object clone() { Object clone = null; try { clone = super.clone(); } catch (CloneNotSupportedException e) { // won't get here... e.printStackTrace(); } return clone; }
From source file:com.gdo.stencils.interpreted.InstDescriptor.java
@SuppressWarnings("unchecked") public InstDescriptor<C, S> copy() { try {//from w ww . j a v a 2 s . c o m InstDescriptor<C, S> copy = (InstDescriptor<C, S>) clone(); return copy; } catch (CloneNotSupportedException e) { e.printStackTrace(); return null; } }
From source file:de.betterform.agent.web.event.EventQueue.java
/** Adding XMLEvents to the EventQueue to be processed on the client * EventTarget is nulled to avoid sending it over the wire, targetName and targetId (received from EventTarget) * are stored instead in the ContextInfo Map * * @param event XMLEvent received from processor *///from w w w. jav a2 s . c o m public void add(XMLEvent event) { try { XMLEvent clonedEvent = (XMLEvent) event.clone(); Element target = (Element) clonedEvent.getTarget(); clonedEvent.addProperty("targetId", target.getAttributeNS(null, "id")); String targetName = target.getLocalName(); clonedEvent.addProperty("targetName", targetName); if ((BetterFormEventNames.ITEM_CHANGED.equals(clonedEvent.getType()) || BetterFormEventNames.STATE_CHANGED.equals(clonedEvent.getType()) && HELPER_ELEMENTS.contains(targetName)) || BetterFormEventNames.PROTOTYPE_CLONED.equals(clonedEvent.getType()) || BetterFormEventNames.ITEM_DELETED.equals(clonedEvent.getType())) { // parent id is needed for updating all helper elements cause they // are identified by '<parentId>-label' etc. rather than their own id String parentId = ((Element) target.getParentNode()).getAttributeNS(null, "id"); clonedEvent.addProperty("parentId", parentId); } else if (BetterFormEventNames.STATE_CHANGED.equals(clonedEvent.getType()) && XFormsConstants.OUTPUT.equals(targetName) && XFormsConstants.LABEL.equals(target.getParentNode().getLocalName()) && XFormsConstants.TRIGGER.equals(target.getParentNode().getParentNode().getLocalName())) { // for outputs within labels of triggers add the trigger id as parentId and 'label' as targetName to the event String parentId = ((Element) target.getParentNode().getParentNode()).getAttributeNS(null, "id"); clonedEvent.addProperty("parentId", parentId); clonedEvent.addProperty("targetName", XFormsConstants.LABEL); } ((XercesXMLEvent) clonedEvent).target = null; ((XercesXMLEvent) clonedEvent).currentTarget = null; if (isLoadEmbedEvent(clonedEvent)) { this.loadEmbedEventList.add(clonedEvent); } else { this.eventList.add(clonedEvent); } } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }