List of usage examples for java.lang CloneNotSupportedException getMessage
public String getMessage()
From source file:org.mule.transaction.MuleTransactionConfig.java
public ConstraintFilter getConstraint() { if (constraint == null) { return null; }//from ww w.j a v a 2s. c o m try { return (ConstraintFilter) constraint.clone(); } catch (CloneNotSupportedException e) { logger.fatal("Failed to clone ConstraintFilter: " + e.getMessage(), e); return constraint; } }
From source file:org.onosproject.yang.serializers.xml.XmlSerializer.java
@Override public CompositeStream encode(CompositeData internal, YangSerializerContext context) { String uriString = null;//from w ww .j a v a 2 s. c o m ResourceId.Builder builder; ResourceId resourceId = internal.resourceData().resourceId(); if (resourceId != null && resourceId.nodeKeys() != null && !resourceId.nodeKeys().isEmpty()) { uriString = convertRidToUri(resourceId); try { builder = resourceId.copyBuilder(); } catch (CloneNotSupportedException e) { throw new XmlSerializerException(e.getMessage()); } } else { /* * If resource id is null, initialise resource id with context * and get the resource id builder. Resource id is built for each * data node and checked in annotation map for annotations * associated with resource id. */ builder = ResourceId.builder(); } // Store annotations in map with resource id as key Map<ResourceId, List<Annotation>> annotations = new HashMap<>(); List<AnnotatedNodeInfo> annotationList = internal.annotatedNodesInfo(); if (annotationList != null) { for (AnnotatedNodeInfo annotationInfo : annotationList) { annotations.put(annotationInfo.resourceId(), annotationInfo.annotations()); } } // Walk through data node and build the XML List<DataNode> dataNodes = internal.resourceData().dataNodes(); StringBuilder sb = new StringBuilder(); for (DataNode dataNode : dataNodes) { DataNodeXmlListener listener = new DataNodeXmlListener(annotations, builder); walk(listener, dataNode); sb.append(listener.xmlData()); } // convert XML to input stream and build composite stream InputStream inputStream = IOUtils.toInputStream(sb.toString()); return new DefaultCompositeStream(uriString, inputStream); }
From source file:org.parosproxy.paros.core.scanner.Analyser.java
private String getPathRegex(URI uri) throws URIException { URI newUri;//from w ww . j a va2s. c om // ZAP: catch CloneNotSupportedException as introduced with version 3.1 of HttpClient try { newUri = (URI) uri.clone(); } catch (CloneNotSupportedException e) { throw new URIException(e.getMessage()); } String query = newUri.getQuery(); StringBuilder sb = new StringBuilder(100); // case should be sensitive //sb.append("(?i)"); newUri.setQuery(null); sb.append(newUri.toString().replaceAll("\\.", "\\.")); if (query != null) { String queryPattern = "(\\?" + query + ")?"; sb.append(queryPattern); } return sb.toString(); }
From source file:org.parosproxy.paros.extension.filter.FilterLogCookie.java
@Override public void onHttpRequestSend(HttpMessage msg) { HttpRequestHeader header = msg.getRequestHeader(); if (header != null) { String cookie = header.getHeader("Cookie"); synchronized (cookieList) { if (cookie != null && cookieList.indexOf(cookie) == -1) { try { // ZAP: catch CloneNotSupportedException as introduced with version 3.1 of HttpClient URI uri;//from w w w . j a va 2s . c om try { uri = (URI) header.getURI().clone(); } catch (CloneNotSupportedException e) { throw new URIException(e.getMessage()); } uri.setQuery(null); String sUri = uri.toString(); cookieList.add(cookie); getView().getOutputPanel().append(sUri + DELIM + cookie + "\n"); } catch (URIException e) { // ZAP: Print stack trace to Output tab getView().getOutputPanel().append(e); } } } } }
From source file:org.pepstock.jem.ant.tasks.StepListener.java
/** * Called to loads all defined tasks specific target, setting the order * @param task TASK// w w w .j a v a2 s. co m * @param order order of step/task */ private void loadForLock(Task task, int order) { if (task instanceof UnknownElement) { UnknownElement uePre = (UnknownElement) task; UnknownElement ue; try { // must object to be cloned // otherwise some actions (like ANT variables substitutions) // are not applied on JCL ue = (UnknownElement) uePre.clone(); ue.maybeConfigure(); if (ue.getTask() instanceof DataDescriptionStep) { DataDescriptionStep item = (DataDescriptionStep) ue.getTask(); item.setOrder(order); StepsContainer.getInstance().getDataDescriptionSteps().add(item); } else if (ue.getTask() instanceof Procedure) { Procedure proc = (Procedure) ue.getTask(); proc.setOrder(order); ProceduresContainer.getInstance().getProcedures().add(proc); } else if (ue.getRealThing() instanceof ProcedureDefinition) { ProcedureDefinition def = (ProcedureDefinition) ue.getRealThing(); ProceduresContainer.getInstance().getProceduresDefinitions().put(def.getName(), def); } } catch (CloneNotSupportedException e) { // debug LogAppl.getInstance().debug(e.getMessage(), e); } } }
From source file:org.projectforge.business.teamcal.filter.TemplateCalendarProperties.java
@Override public TemplateCalendarProperties clone() { try {//from ww w. j a v a 2 s .c om final TemplateCalendarProperties cloned = (TemplateCalendarProperties) super.clone(); cloned.calId = this.calId; cloned.colorCode = this.colorCode; cloned.millisOfLastChange = this.millisOfLastChange; cloned.visible = this.visible; return cloned; } catch (final CloneNotSupportedException ex) { log.error(ex.getMessage(), ex); return null; } }
From source file:org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade.java
public PublishedAssessmentFacade clonePublishedAssessment() { try {// w w w. j a va 2 s. c o m return (PublishedAssessmentFacade) this.clone(); } catch (CloneNotSupportedException e) { log.warn(e.getMessage()); return null; } }
From source file:org.stanwood.nwn2.gui.view.UIButtonView.java
private void createView(UIButton button) { UIButton newButton = button;//from w ww.ja v a 2s . c o m if (button.getStyle() != null) { UIObject styleButton = StyleSheetManager.getInstance().getObjectByName(button.getStyle()); if (styleButton != null) { try { newButton = (UIButton) button.clone(); newButton.applyStyle(styleButton); } catch (CloneNotSupportedException e) { log.error("Unable to clone button, " + e.getMessage(), e); } } else { log.error("Unable to find the style: " + button.getStyle()); } } for (NWN2GUIObject uiObject : newButton.getChildren()) { if (uiObject instanceof UIText) { UIText text = (UIText) uiObject; if (newButton.getText() != null) { text.setText(newButton.getText()); } if (newButton.getStrRef() != null) { text.setStrRef(newButton.getStrRef()); } } UIObjectView viewChild = UIObjectFactory.createViewObject(uiObject, getScene()); if (newButton.getX() != null && newButton.getY() != null) { viewChild.setX(newButton.getX().getValue(getScreenDimension(), getScene())); viewChild.setY(newButton.getY().getValue(getScreenDimension(), getScene())); } addChild(viewChild); } }
From source file:org.stanwood.nwn2.gui.view.UIScrollBarView.java
private void createView(UIScrollBar scrollBar) { UIScrollBar newScrollBar = scrollBar; if (scrollBar.getStyle() != null) { UIObject styleListBox = StyleSheetManager.getInstance().getObjectByName(scrollBar.getStyle()); if (styleListBox != null) { try { newScrollBar = (UIScrollBar) scrollBar.clone(); newScrollBar.applyStyle(styleListBox); } catch (CloneNotSupportedException e) { log.error("Unable to clone button, " + e.getMessage(), e); }//from w w w .j a v a 2 s .c o m } else { log.error("Unable to find the style: " + scrollBar.getStyle()); } } up = getChildWithState(newScrollBar, "up"); down = getChildWithState(newScrollBar, "down"); slider = getChildWithState(newScrollBar, "slider"); back = getChildWithState(newScrollBar, "back"); if (up != null) { setWidth(up.getWidth()); addChild(up); } if (down != null) { addChild(down); } if (back != null) { addChild(back); } if (slider != null) { addChild(slider); } }
From source file:pcgen.core.Equipment.java
/** * Description of the Method/*from w ww .j ava 2s . c o m*/ * * @return Description of the Return Value */ @Override public Equipment clone() { Equipment eq = null; try { eq = (Equipment) super.clone(); eq.heads = new ArrayList<>(); for (EquipmentHead head : heads) { if (head == null) { eq.heads.add(null); } else { EquipmentHead eh = new EquipmentHead(eq, head.getHeadIndex()); eh.overlayCDOMObject(head); eq.heads.add(eh); } } // if (bonusMap != null) { eq.bonusMap = new HashMap<>(bonusMap); } eq.setMoveString(moveString()); // eq.setTypeString(super.getType()); // none of the types associated with modifiers eq.carried = carried; eq.equipped = equipped; eq.location = location; eq.numberEquipped = numberEquipped; eq.qty = qty; eq.outputIndex = outputIndex; eq.d_childTypes = new HashMap<>(d_childTypes); eq.d_containedEquipment = new ArrayList<>(d_containedEquipment); eq.assocSupt = assocSupt.clone(); eq.getEquipmentHead(1).removeListFor(ListKey.EQMOD); eq.getEquipmentHead(2).removeListFor(ListKey.EQMOD); eq.getEquipmentHead(1).addAllToListFor(ListKey.EQMOD, cloneEqModList(eq, true)); eq.getEquipmentHead(2).addAllToListFor(ListKey.EQMOD, cloneEqModList(eq, false)); } catch (CloneNotSupportedException e) { ShowMessageDelegate.showMessageDialog(e.getMessage(), Constants.APPLICATION_NAME, MessageType.ERROR); } return eq; }