List of usage examples for java.lang CloneNotSupportedException printStackTrace
public void printStackTrace()
From source file:edu.ku.brc.specify.datamodel.SpReport.java
/** * @param repo// w w w. ja v a 2 s . c o m */ public void setReportObject(DataModelObjBase repo) { if (repo instanceof SpQuery) { setQuery((SpQuery) repo); } else if (repo instanceof Workbench) { Workbench wb = (Workbench) repo; try { setWorkbenchTemplate((WorkbenchTemplate) wb.getWorkbenchTemplate().clone()); } catch (CloneNotSupportedException cnsex) { UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpReport.class, cnsex); cnsex.printStackTrace(); throw new RuntimeException(cnsex); } } else { log.error("unable to set report object of class " + repo.getClass().getName()); } }
From source file:net.jcreate.xkins.Skin.java
/** * Devuelve un Path dado el nombre. si no lo encuentra en el skin y el skin tiene extends, le pide * al skin padre el path. Si el padre le puede dar el path, lo clona y lo guarda para la * prxima vez. Asi se implementa la herencia. * @see Path/*from ww w .j a v a 2 s .c o m*/ * @param name * @return */ public Path getPath(String name) { Object obj = this.getPaths().get(name); if (obj != null) { return (Path) obj; } else { obj = ((this.isExtending()) ? this.getExtendedSkin().getPath(name) : null); Path p = null; if (obj != null) { //clona el path try { p = (Path) ((Path) obj).clone(); p.setSkin(this); this.getPaths().put(name, p); //cachea la referencia para la prxima vez... } catch (CloneNotSupportedException cnse) { cnse.printStackTrace(); } } return p; } }
From source file:net.jcreate.xkins.Skin.java
/** * Devuelve un Resource dado el nombre. Si no lo encuentra y tiene extends, le pide el resource al Skin padre. * Si lo encuentra en el padre, lo clona y lo guarda para la prxima vez. Esto permite heredar resources entre Skins. * @see Resource// ww w .ja va 2 s . com * @param name * @return */ public Resource getResource(String name) { Resource obj = (Resource) this.getResources().get(name); if (obj != null) { return obj; } else { obj = ((this.isExtending()) ? this.getExtendedSkin().getResource(name) : null); Resource r = null; if (obj != null) { //clona el Resource try { r = (Resource) obj.clone(); r.setTemplate(null); //implica globa resource r.setSkin(this); this.getResources().put(name, r); //cachea la referencia para la prxima vez... } catch (CloneNotSupportedException cnse) { cnse.printStackTrace(); } } return r; } }
From source file:net.jcreate.xkins.Skin.java
/** * Devuelve el template del skin dado el nombre. Si no lo encuentra y tiene extends, le pide al skin padre * el template. Si lo encuentra, lo clona y lo guarda para la prxima vez. De esta manera se implementa la herencia * de templates.//w ww .j a v a 2s. co m * @param name * @return */ public Template getTemplate(String name) { Object obj = this.getTemplates().get(name); if (obj != null) { Template tmpObj = (Template) obj; //verifica la composicin de los tempaltes if (this.getXkins() != null && this.getXkins().getSkin(tmpObj.getSrcSkin()) != null) { Template srcTemplate = this.getXkins().getSkin(tmpObj.getSrcSkin()).getTemplate(name); if (srcTemplate != null) { tmpObj.setDelegate(srcTemplate); } } return tmpObj; } else { obj = ((this.isExtending()) ? this.getExtendedSkin().getTemplate(name) : null); Template tmpl = null; if (obj != null) { //clona el template try { tmpl = (Template) ((Template) obj).clone(); tmpl.setSkin(this); this.getTemplates().put(name, tmpl); //cachea la referencia para la prxima vez... //marca como modificado this.addTemplateModified(tmpl); } catch (CloneNotSupportedException cnse) { cnse.printStackTrace(); } } return tmpl; } }
From source file:imagingbook.pub.fd.FourierDescriptor.java
public FourierDescriptor clone() { FourierDescriptor fd2 = null;//from w w w . j av a 2s. c o m try { fd2 = (FourierDescriptor) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } fd2.g = Complex.duplicate(this.g); fd2.G = Complex.duplicate(this.G); return fd2; }
From source file:org.commoncrawl.service.listcrawler.CrawlHistoryManager.java
private static void syncAndValidateItems(TreeMap<URLFP, ProxyCrawlHistoryItem> items, CrawlHistoryManager logManager) throws IOException { // ok now sync the list final TreeMap<URLFP, ProxyCrawlHistoryItem> syncedItemList = new TreeMap<URLFP, ProxyCrawlHistoryItem>(); try {/*from w w w . j a va 2s.co m*/ logManager.syncList(0L, Sets.newTreeSet(items.keySet()), new ItemUpdater() { @Override public void updateItemState(URLFP fingerprint, ProxyCrawlHistoryItem item) throws IOException { try { syncedItemList.put((URLFP) fingerprint.clone(), (ProxyCrawlHistoryItem) item.clone()); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } }); } catch (IOException e) { LOG.error(CCStringUtils.stringifyException(e)); Assert.assertTrue(false); } // assert that the key set is equal Assert.assertEquals(items.keySet(), syncedItemList.keySet()); // ok now validate that the values are equal for (Map.Entry<URLFP, ProxyCrawlHistoryItem> item : items.entrySet()) { ProxyCrawlHistoryItem other = syncedItemList.get(item.getKey()); Assert.assertEquals(item.getValue(), other); } }
From source file:com.projity.pm.calendar.WorkingCalendar.java
public WorkingCalendar makeScratchCopy() { WorkingCalendar newOne = null;//from ww w . j av a 2 s.co m try { newOne = new WorkingCalendar(); newOne.baseCalendar = baseCalendar; newOne.setName(getName()); newOne.differences = (CalendarDefinition) differences.clone(); } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return newOne; }
From source file:com.distrimind.madkit.kernel.MadkitProperties.java
@Override public MadkitProperties clone() { try {//from w ww . ja va2 s .c o m return (MadkitProperties) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); return null; } }
From source file:de.blinkt.openvpn.core.ConfigParser.java
private Pair<Connection, Connection[]> parseConnectionOptions(Connection connDefault) throws ConfigParseError { Connection conn;/*from w w w . j a va2 s . c o m*/ if (connDefault != null) try { conn = connDefault.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); return null; } else conn = new Connection(); Vector<String> port = getOption("port", 1, 1); if (port != null) { conn.mServerPort = port.get(1); } Vector<String> rport = getOption("rport", 1, 1); if (rport != null) { conn.mServerPort = rport.get(1); } Vector<String> proto = getOption("proto", 1, 1); if (proto != null) { conn.mUseUdp = isUdpProto(proto.get(1)); } Vector<String> connectTimeout = getOption("connect-timeout", 1, 1); if (connectTimeout != null) { try { conn.mConnectTimeout = Integer.parseInt(connectTimeout.get(1)); } catch (NumberFormatException nfe) { throw new ConfigParseError( String.format("Argument to connect-timeout (%s) must to be an integer: %s", connectTimeout.get(1), nfe.getLocalizedMessage())); } } // Parse remote config Vector<Vector<String>> remotes = getAllOption("remote", 1, 3); // Assume that we need custom options if connectionDefault are set if (connDefault != null) { for (Vector<Vector<String>> option : options.values()) { conn.mCustomConfiguration += getOptionStrings(option); } if (!TextUtils.isEmpty(conn.mCustomConfiguration)) conn.mUseCustomConfig = true; } // Make remotes empty to simplify code if (remotes == null) remotes = new Vector<Vector<String>>(); Connection[] connections = new Connection[remotes.size()]; int i = 0; for (Vector<String> remote : remotes) { try { connections[i] = conn.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } switch (remote.size()) { case 4: connections[i].mUseUdp = isUdpProto(remote.get(3)); case 3: connections[i].mServerPort = remote.get(2); case 2: connections[i].mServerName = remote.get(1); } i++; } return Pair.create(conn, connections); }