List of usage examples for java.lang CloneNotSupportedException printStackTrace
public void printStackTrace()
From source file:com.baitouwei.swiperefresh.ASwipeRefreshLayout.java
public ASwipeRefreshLayout setFooterView(SwipeView footerView) { SwipeView.Config config = null;/*from w ww . jav a 2s . c o m*/ try { config = this.footerView.getConfig().clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } int pos = indexOfChild(this.footerView); removeView(this.footerView); addView(footerView, pos); this.footerView = footerView; this.footerView.setConfig(config); return this; }
From source file:com.baitouwei.swiperefresh.ASwipeRefreshLayout.java
public ASwipeRefreshLayout setHeaderView(SwipeView headerView) { SwipeView.Config config = null;/*from ww w . ja va 2 s. c o m*/ try { config = this.headerView.getConfig().clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } int pos = indexOfChild(this.headerView); removeView(this.headerView); addView(headerView, pos); this.headerView = headerView; this.headerView.setConfig(config); return this; }
From source file:edu.duke.cabig.c3pr.domain.Study.java
public void createAmendment() { if (this.getCoordinatingCenterStudyStatus() == CoordinatingCenterStudyStatus.CLOSED_TO_ACCRUAL || this .getCoordinatingCenterStudyStatus() == CoordinatingCenterStudyStatus.CLOSED_TO_ACCRUAL_AND_TREATMENT || this.getCoordinatingCenterStudyStatus() == CoordinatingCenterStudyStatus.PENDING) { throw getC3PRExceptionHelper().getRuntimeException( getCode("C3PR.EXCEPTION.STUDY.STUDY_NOT_AMENDABLE.CODE"), new String[] { this.getCoordinatingCenterStudyStatus().getDisplayName() }); }/*from www .j a v a 2 s . c o m*/ if (this.getStudyVersion().getVersionStatus() != StatusType.AC) { throw getC3PRExceptionHelper().getRuntimeException( getCode("C3PR.EXCEPTION.STUDY.STUDY_EXISTING_AMENDMENT.CODE"), new String[] { this.getCoordinatingCenterStudyStatus().getDisplayName() }); } try { this.addStudyVersion((StudyVersion) getLatestStudyVersion().clone()); } catch (CloneNotSupportedException e) { e.printStackTrace(); } }
From source file:TarInputStream.java
/** * TarHeaders can be cloned.//from w w w . j a v a2s . c om */ public Object clone() { TarHeader hdr = null; try { hdr = (TarHeader) super.clone(); hdr.name = (this.name == null) ? null : new StringBuffer(this.name.toString()); hdr.mode = this.mode; hdr.userId = this.userId; hdr.groupId = this.groupId; hdr.size = this.size; hdr.modTime = this.modTime; hdr.checkSum = this.checkSum; hdr.linkFlag = this.linkFlag; hdr.linkName = (this.linkName == null) ? null : new StringBuffer(this.linkName.toString()); hdr.magic = (this.magic == null) ? null : new StringBuffer(this.magic.toString()); hdr.userName = (this.userName == null) ? null : new StringBuffer(this.userName.toString()); hdr.groupName = (this.groupName == null) ? null : new StringBuffer(this.groupName.toString()); hdr.devMajor = this.devMajor; hdr.devMinor = this.devMinor; } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } return hdr; }
From source file:org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueries.java
public AssessmentData cloneAssessmentFromTemplate(AssessmentTemplateData t) { // log.debug("**** DEFAULT templateId inside clone" + // t.getAssessmentTemplateId()); AssessmentData assessment = new AssessmentData(t.getParentId(), "Assessment created with" + t.getTitle(), t.getDescription(), t.getComments(), t.getAssessmentTemplateId(), TypeD.HOMEWORK, // by default for now t.getInstructorNotification(), t.getTesteeNotification(), t.getMultipartAllowed(), t.getStatus(), AgentFacade.getAgentString(), new Date(), AgentFacade.getAgentString(), new Date()); try {/*from w w w . jav a2 s . c o m*/ // deal with Access Control AssessmentAccessControl controlOrig = (AssessmentAccessControl) t.getAssessmentAccessControl(); if (controlOrig != null) { AssessmentAccessControl control = (AssessmentAccessControl) controlOrig.clone(); control.setAssessmentBase(assessment); assessment.setAssessmentAccessControl(control); } // deal with feedback AssessmentFeedback feedbackOrig = (AssessmentFeedback) t.getAssessmentFeedback(); if (feedbackOrig != null) { AssessmentFeedback feedback = (AssessmentFeedback) feedbackOrig.clone(); feedback.setAssessmentBase(assessment); assessment.setAssessmentFeedback(feedback); } // deal with evaluation EvaluationModel evalOrig = (EvaluationModel) t.getEvaluationModel(); if (evalOrig != null) { EvaluationModel eval = (EvaluationModel) evalOrig.clone(); eval.setAssessmentBase(assessment); assessment.setEvaluationModel(eval); } // deal with MetaData HashSet h = new HashSet(); Set s = t.getAssessmentMetaDataSet(); Iterator iter = s.iterator(); while (iter.hasNext()) { AssessmentMetaData mOrig = (AssessmentMetaData) iter.next(); if (mOrig.getLabel() != null) { AssessmentMetaData m = new AssessmentMetaData(assessment, mOrig.getLabel(), mOrig.getEntry()); h.add(m); } } assessment.setAssessmentMetaDataSet(h); // we need to add the FIRST section to an assessment // it is a requirement that each assesment must have at least one // section HashSet sh = new HashSet(); SectionData section = new SectionData(null, new Integer("1"), // FIRST section "Default", "", TypeD.DEFAULT_SECTION, SectionData.ACTIVE_STATUS, AgentFacade.getAgentString(), new Date(), AgentFacade.getAgentString(), new Date()); section.setAssessment(assessment); // add default part type, and question Ordering section.addSectionMetaData(SectionDataIfc.AUTHOR_TYPE, SectionDataIfc.QUESTIONS_AUTHORED_ONE_BY_ONE.toString()); section.addSectionMetaData(SectionDataIfc.QUESTIONS_ORDERING, SectionDataIfc.AS_LISTED_ON_ASSESSMENT_PAGE.toString()); sh.add(section); assessment.setSectionSet(sh); } catch (CloneNotSupportedException ex) { ex.printStackTrace(); } return assessment; }
From source file:org.kepler.ddp.Utilities.java
/** Load the model for a stub from a Nephele Configuration. The * top-level ports and connected relations are removed. *//*from ww w .j ava 2s . c o m*/ public static synchronized CompositeActor getModel(String modelName, String modelString, String modelFile, boolean sameJVM, String redirectDir) { CompositeActor model = null; if (modelName == null) { throw new RuntimeException("Subworkflow name was not set in configuration."); } if (sameJVM) { CompositeActor originalModel = DDPEngine.getModel(modelName); try { model = (CompositeActor) originalModel.clone(new Workspace()); } catch (CloneNotSupportedException e) { throw new RuntimeException("Error cloning subworkflow: " + e.getMessage()); } Utilities.removeModelPorts(model); // create an effigy for the model so that gui actors can open windows. DDPEngine.createEffigy(model); } else { List<?> filters = MoMLParser.getMoMLFilters(); Workspace workspace = new Workspace(); final MoMLParser parser = new MoMLParser(workspace); //parser.resetAll(); MoMLParser.setMoMLFilters(null); MoMLParser.setMoMLFilters(BackwardCompatibility.allFilters(), workspace); if (redirectDir.isEmpty()) { MoMLParser.addMoMLFilter(new RemoveGraphicalClasses(), workspace); } else { //redirect display-related actors final String pid = ManagementFactory.getRuntimeMXBean().getName(); final String threadId = String.valueOf(Thread.currentThread().getId()); final String displayPath = redirectDir + File.separator + pid + "_" + threadId; MoMLParser.addMoMLFilter(new DisplayRedirectFilter(displayPath), workspace); final ArrayList<PtolemyModule> actorModules = new ArrayList<PtolemyModule>(); actorModules.add(new PtolemyModule(ResourceBundle.getBundle("org/kepler/ActorModuleBatch"))); Initializer _defaultInitializer = new Initializer() { @Override public void initialize() { PtolemyInjector.createInjector(actorModules); } }; ActorModuleInitializer.setInitializer(_defaultInitializer); } // get the model from the configuration // see if model is in the configuration. if (modelString != null) { try { model = (CompositeActor) parser.parse(modelString); } catch (Exception e) { throw new RuntimeException("Error parsing model " + modelName + ": " + e.getMessage()); } //LOG.info("parsed model from " + modelString); } else { // the model was saved as a file. if (modelFile == null) { throw new RuntimeException("No model for " + modelName + " in configuration."); } // load the model try { model = (CompositeActor) parser.parseFile(modelFile); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException( "Error parsing model " + modelName + " in file " + modelFile + ": " + e.getMessage()); } LOG.info("parsed model from " + modelFile); } // restore the moml filters MoMLParser.setMoMLFilters(null); MoMLParser.setMoMLFilters(filters); // remove provenance recorder and reporting listener final List<Attribute> toRemove = new LinkedList<Attribute>( model.attributeList(ProvenanceRecorder.class)); toRemove.addAll(model.attributeList(ReportingListener.class)); for (Attribute attribute : toRemove) { try { attribute.setContainer(null); } catch (Exception e) { throw new RuntimeException("Error removing " + attribute.getName() + ": " + e.getMessage()); } } } return model; }
From source file:com.projity.field.Field.java
public Object clone() { // TODO Auto-generated method stub try {/* w w w . ja v a 2 s . co m*/ return super.clone(); } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }
From source file:org.ecocean.Encounter.java
public Encounter getClone() { Encounter tempEnc = new Encounter(); try {/* ww w . ja v a 2s.c o m*/ tempEnc = (Encounter) this.clone(); } catch (java.lang.CloneNotSupportedException e) { e.printStackTrace(); } return tempEnc; }
From source file:edu.ku.brc.specify.tasks.WorkbenchTask.java
/** * @param action/*from w w w . j a va 2 s . c om*/ * * Exports records in a recordset to a pre-defined workbench template. */ protected void exportRStoDS(final CommandAction action) { //UIRegistry.displayErrorDlg("Exporting to wb"); //Choose a recordset if the action is not a rs drop Vector<Integer> tblIds = new Vector<Integer>(); ChooseRecordSetDlg dlg = new ChooseRecordSetDlg(tblIds); dlg.setHelpContext("wb_recordset"); dlg.setVisible(true); // modal (waits for answer here) if (!dlg.isCancelled()) { //check size if (dlg.getSelectedRecordSet().getNumItems() > AppPreferences.getRemote().getInt("MAX_ROWS", MAX_ROWS)) { UIRegistry.showLocalizedError("WorkbenchTask.RecordSetTooLargeToExport", AppPreferences.getRemote().getInt("MAX_ROWS", MAX_ROWS)); return; } //Choose a workbench whose 'main' table matches the type of the recordset List<WorkbenchTemplate> choices = getTemplatesForExport(dlg.getSelectedRecordSet()); if (choices.size() > 0) { ChooseFromListDlg<WorkbenchTemplate> wbtdlg = new ChooseFromListDlg<WorkbenchTemplate>( (Frame) UIRegistry.getTopWindow(), UIRegistry.getResourceString("WB_CHOOSE_EXPORT_WB_TITLE"), ChooseFromListDlg.OK_BTN | ChooseFromListDlg.CANCEL_BTN | ChooseFromListDlg.HELP_BTN, choices); wbtdlg.setHelpContext("wb_recordset"); wbtdlg.setVisible(true); if (!wbtdlg.isCancelled()) { //load the data try { Workbench workbench = createNewWorkbenchDataObj(null, (WorkbenchTemplate) wbtdlg.getSelectedObject().clone()); if (workbench != null) { fillandSaveWorkbench(dlg.getSelectedRecordSet(), workbench); } } catch (CloneNotSupportedException ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(WorkbenchTask.class, ex); ex.printStackTrace(); log.error(ex); } } } else { UIRegistry.showLocalizedMsg("WB_UNABLE_TO_EXPORT_RS", "WB_NO_TEMPLATES_TO_EXPORT_RS_TO", DBTableIdMgr.getInstance().getInfoById(dlg.getSelectedRecordSet().getDbTableId()) .getClassObj().getSimpleName()); } } }
From source file:com.mc.printer.model.panel.task.BuildGuideTask.java
@Override public Object doBackgrounp() { javax.swing.JTabbedPane tabs = AutoPrinterApp.getMainView().getMainWorkPanel(); if (tabs != null) { if (tabs.getSelectedIndex() >= 0) { Component selectedcom = tabs.getSelectedComponent(); if (selectedcom instanceof GuideWork) { GuideWork selectPanel = (GuideWork) selectedcom; GuideBean presentBeansForm = selectPanel.getBeansForm(); logger.debug("selected tab:" + selectPanel.getName()); //? GuideBean beansForm;//from www .j av a2 s.com try { beansForm = presentBeansForm.clone(); } catch (CloneNotSupportedException ex) { logger.error(ex.getMessage()); beansForm = presentBeansForm; } String backGroundImg = beansForm.getBackgoundImg(); // Set<String> imgArray = new HashSet(); if (backGroundImg != null) { File file = new File(backGroundImg); if (file.exists() && file.isFile()) { beansForm.setBackgoundImg(file.getName()); imgArray.add(backGroundImg); } else { beansForm.setBackgoundImg(""); } } else { beansForm.setBackgoundImg(""); } HashMap<String, GuideCompBean> parameterMap = new HashMap<String, GuideCompBean>(); HashMap<String, GuideCompBean> parentParameterMap = selectPanel.getSavedForms(); deepCloneMap(parameterMap, parentParameterMap); if (parameterMap.size() > 0) { Set set = parameterMap.keySet(); //??? List<GuideCompBean> beans = new ArrayList(); Iterator it = set.iterator(); while (it.hasNext()) { GuideCompBean com = parameterMap.get(it.next().toString()); beans.add(com); String pressedIcon = com.getPressedIcon(); String icon = com.getIcon(); if (pressedIcon != null && !pressedIcon.equals("")) { File pressfile = new File(pressedIcon); if (pressfile.exists() && pressfile.isFile()) { imgArray.add(pressedIcon); com.setPressedIcon(pressfile.getName()); } else { com.setPressedIcon(""); } } if (icon != null && !icon.equals("")) { File iconfile = new File(icon); if (iconfile.exists() && iconfile.isFile()) { imgArray.add(icon); com.setIcon(iconfile.getName()); } else { com.setIcon(""); } } } beansForm.setElements(beans); BaseFileChoose fileChoose = new BaseFileChoose("?", new String[] { Constants.MODEL_SUFFIX }, AutoPrinterApp.getMainFrame()); String selectedPath = fileChoose.showSaveDialog(); if (!selectedPath.trim().equals("")) { //get formname selectedPath = selectedPath + File.separator + beansForm.getGuideName(); //String time=DateHelper.format(new Date(), "yyyyMMddHHmmss"); String finalZip = selectedPath; if (!selectedPath.endsWith("." + Constants.GUIDE_SUFFIX)) { finalZip = selectedPath + "." + Constants.GUIDE_SUFFIX; } String tempDir = selectedPath + File.separator + Constants.GUIDE_TEMP_DIR; String xmlPath = tempDir + File.separator + beansForm.getGuideName() + ".xml"; XMLHelper helper = new XMLHelper(xmlPath, beansForm); try { helper.write(); } catch (JAXBException ex) { ex.printStackTrace(); logger.error(ex.getMessage()); return ex; } File paramFile = new File(xmlPath); if (paramFile.isFile() && paramFile.exists()) { try { logger.info("copy file and zip temp for:" + tempDir + ",total of attached file:" + imgArray.size()); File _temp = new File(tempDir); for (String img : imgArray) { File imgFile = new File(img); logger.debug("copy image:" + imgFile.getName()); FileUtils.copyFileToDirectory(imgFile, _temp); } ZipHelper.createZip(tempDir, finalZip); logger.info("zip file successfully."); return "??.\r\n" + finalZip; } catch (IOException ex) { ex.printStackTrace(); logger.error(ex.getMessage()); return ex; } finally { try { FileUtils.deleteDirectory(new File(selectedPath)); } catch (IOException ex) { ex.printStackTrace(); logger.error(ex.getMessage()); return ex; } } } else { logger.error("generator faild for:" + xmlPath); } } } else { return "??."; } } else { return "??????."; } } else { return "?."; } } else { return "?."; } return null; }