code
stringlengths
31
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public String toString() { StringBuilder builder = new StringBuilder(); synchronized (fLock) { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); // Indentation is done with XmlUtil.prettyFormat(doc). // For debugging, the prettyFormat may not have been run yet, // so turning this to "yes" may be helpful on occasion. transformer.setOutputProperty(OutputKeys.INDENT, "no"); //$NON-NLS-1$ DOMSource source = new DOMSource(fElement); StreamResult result = new StreamResult(stream); transformer.transform(source, result); builder.append(stream.toString()); } catch (Exception e) { return fElement.toString(); } } return builder.toString(); }
Base
1
private UserDefinedVariableSupplier() { fListeners = Collections.synchronizedSet(new HashSet<ICdtVariableChangeListener>()); }
Base
1
private StorableCdtVariables loadMacrosFromStream(InputStream stream, boolean readOnly) { try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource inputSource = new InputSource(stream); Document document = parser.parse(inputSource); Element rootElement = document.getDocumentElement(); if (!StorableCdtVariables.MACROS_ELEMENT_NAME.equals(rootElement.getNodeName())) return null; return new StorableCdtVariables(new XmlStorageElement(rootElement), readOnly); } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (IOException e) { } return null; }
Base
1
private ByteArrayOutputStream storeMacrosToStream(StorableCdtVariables macros) throws CoreException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element rootElement = document.createElement(StorableCdtVariables.MACROS_ELEMENT_NAME); document.appendChild(rootElement); ICStorageElement storageElement = new XmlStorageElement(rootElement); macros.serialize(storageElement); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(document); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamResult result = new StreamResult(stream); transformer.transform(source, result); return stream; } catch (ParserConfigurationException e) { throw ExceptionFactory.createCoreException(e.getMessage(), e); } catch (TransformerConfigurationException e) { throw ExceptionFactory.createCoreException(e.getMessage(), e); } catch (TransformerException e) { throw ExceptionFactory.createCoreException(e.getMessage(), e); } }
Base
1
public void updateToBackEndStorage(String updateName, String updateValue) { try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(parsedXML.toURI().toURL().openStream()); } catch (Exception exp) { TemplateEngineUtil.log(exp); } persistDataMap.putAll(sharedDefaultsMap); List<Element> sharedElementList = TemplateEngine.getChildrenOfElement(document.getDocumentElement()); int elementListSize = sharedElementList.size(); for (int i = 0; i < elementListSize; i++) { Element xmlElement = sharedElementList.get(i); String name = xmlElement.getAttribute(TemplateEngineHelper.ID); if (updateName.equals(name)) { persistDataMap.put(updateName, updateValue); } } updateShareDefaultsMap(persistDataMap); }
Base
1
private void initSharedDefaults() { String key = null; String value = null; try { long length = parsedXML.length(); // Adds defaultXML format if the file length is zero if (length == 0) { parsedXML = createDefaultXMLFormat(parsedXML); } document = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(parsedXML.toURI().toURL().openStream()); } catch (Exception exp) { TemplateEngineUtil.log(exp); } List<Element> sharedElementList = TemplateEngine.getChildrenOfElement(document.getDocumentElement()); int listSize = sharedElementList.size(); for (int i = 0; i < listSize; i++) { Element xmlElement = sharedElementList.get(i); key = xmlElement.getAttribute(TemplateEngineHelper.ID); value = xmlElement.getAttribute(TemplateEngineHelper.VALUE); if (key != null && !key.trim().isEmpty()) { sharedDefaultsMap.put(key, value); } } }
Base
1
public void deleteBackEndStorage(String[] deleteName) { try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(parsedXML.toURI().toURL().openStream()); } catch (Exception exp) { TemplateEngineUtil.log(exp); } List<Element> sharedElementList = TemplateEngine.getChildrenOfElement(document.getDocumentElement()); int elementListSize = sharedElementList.size(); for (int i = 0; i < elementListSize; i++) { Element xmlElement = sharedElementList.get(i); String name = xmlElement.getAttribute(TemplateEngineHelper.ID); for (int k = 0; k < deleteName.length; k++) { if (deleteName[k].equals(name)) { xmlElement.removeAttribute(name); sharedDefaultsMap.remove(name); } } } updateShareDefaultsMap(sharedDefaultsMap); }
Base
1
private File createDefaultXMLFormat(File xmlFile) { Document d; try { d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { TemplateEngineUtil.log(e); return xmlFile; } Node rootElement = d.appendChild(d.createElement("SharedRoot")); //$NON-NLS-1$ Element element = (Element) rootElement.appendChild(d.createElement("SharedProperty")); //$NON-NLS-1$ element.setAttribute(TemplateEngineHelper.ID, ""); //$NON-NLS-1$ element.setAttribute(TemplateEngineHelper.VALUE, ""); //$NON-NLS-1$ DOMSource domSource = new DOMSource(d); TransformerFactory transFactory = TransformerFactory.newInstance(); try { FileOutputStream fos = null; try { fos = new FileOutputStream(xmlFile); Result fileResult = new StreamResult(fos); transFactory.newTransformer().transform(domSource, fileResult); } finally { if (fos != null) { fos.close(); } } } catch (IOException ioe) { TemplateEngineUtil.log(ioe); } catch (TransformerConfigurationException tce) { TemplateEngineUtil.log(tce); } catch (TransformerException te) { TemplateEngineUtil.log(te); } return xmlFile; }
Base
1
private void generateSharedXML(File xmlFile) { Document d; try { d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { TemplateEngineUtil.log(e); return; } Node rootElement = d.appendChild(d.createElement("SharedRoot")); //$NON-NLS-1$ for (String key : sharedDefaultsMap.keySet()) { Element element = (Element) rootElement.appendChild(d.createElement("SharedProperty")); //$NON-NLS-1$ element.setAttribute(TemplateEngineHelper.ID, key); element.setAttribute(TemplateEngineHelper.VALUE, sharedDefaultsMap.get(key)); } DOMSource domSource = new DOMSource(d); TransformerFactory transFactory = TransformerFactory.newInstance(); Result fileResult = new StreamResult(xmlFile); try { transFactory.newTransformer().transform(domSource, fileResult); } catch (Throwable t) { TemplateEngineUtil.log(t); } }
Base
1
public TemplateDescriptor(URL descriptorURL, String pluginId) throws TemplateInitializationException { String msg = NLS.bind(Messages.TemplateCore_init_failed, descriptorURL.toString()); try { this.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(descriptorURL.openStream()); } catch (ParserConfigurationException pce) { throw new TemplateInitializationException(msg, pce); } catch (IOException ioe) { throw new TemplateInitializationException(msg, ioe); } catch (SAXException se) { throw new TemplateInitializationException(msg, se); } this.rootElement = document.getDocumentElement(); this.persistVector = new ArrayList<>(); this.pluginId = pluginId; }
Base
1
private static Document loadXml(InputStream xmlStream) throws CoreException { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.parse(xmlStream); } catch (Exception e) { throw new CoreException(CCorePlugin.createStatus(Messages.XmlUtil_InternalErrorLoading, e)); } }
Base
1
public static Document newDocument() throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.newDocument(); }
Base
1
private static byte[] toByteArray(Document doc) throws CoreException { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, ENCODING_UTF_8); // Indentation is done with XmlUtil.prettyFormat(doc). transformer.setOutputProperty(OutputKeys.INDENT, "no"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(stream); transformer.transform(source, result); return stream.toByteArray(); } catch (Exception e) { throw new CoreException(CCorePlugin.createStatus(Messages.XmlUtil_InternalErrorSerializing, e)); } }
Base
1
static ICStorageElement environmentStorageFromString(String env) { if (env == null) return null; try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource inputSource = new InputSource(new ByteArrayInputStream(env.getBytes())); Document document = parser.parse(inputSource); Element el = document.getDocumentElement(); XmlStorageElement rootElement = new XmlStorageElement(el); if (!StorableEnvironment.ENVIRONMENT_ELEMENT_NAME.equals(rootElement.getName())) return null; return rootElement; } catch (ParserConfigurationException e) { CCorePlugin.log(e); } catch (SAXException e) { CCorePlugin.log(e); } catch (IOException e) { CCorePlugin.log(e); } return null; }
Base
1
private ByteArrayOutputStream storeEnvironmentToStream(StorableEnvironment env) throws CoreException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element el = document.createElement(StorableEnvironment.ENVIRONMENT_ELEMENT_NAME); document.appendChild(el); XmlStorageElement rootElement = new XmlStorageElement(el); env.serialize(rootElement); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(document); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamResult result = new StreamResult(stream); transformer.transform(source, result); return stream; } catch (ParserConfigurationException e) { throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e)); } catch (TransformerConfigurationException e) { throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e)); } catch (TransformerException e) { throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, e.getMessage(), e)); } }
Base
1
private String getValueFromBackEndStorate(String key) throws Exception { File parsedXML = TemplateEngineHelper.getSharedDefaultLocation("shareddefaults.xml"); Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(parsedXML.toURI().toURL().openStream()); List<Element> sharedElementList = TemplateEngine.getChildrenOfElement(document.getDocumentElement()); int listSize = sharedElementList.size(); for (int i = 0; i < listSize; i++) { Element xmlElement = sharedElementList.get(i); String key2 = xmlElement.getAttribute(TemplateEngineHelper.ID); String value2 = xmlElement.getAttribute(TemplateEngineHelper.VALUE); if (key.equals(key2)) { return value2; } } return null; }
Base
1
public void serialize(ICHelpInvocationContext context) { CHelpSettings settings = getHelpSettings(context); File file = getSettingsFile(); try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc; Element rootElement = null; if (file.exists()) { doc = builder.parse(file); NodeList nodes = doc.getElementsByTagName(ELEMENT_ROOT); if (nodes.getLength() > 0) rootElement = (Element) nodes.item(0); } else { doc = builder.newDocument(); } if (rootElement == null) { rootElement = doc.createElement(ELEMENT_ROOT); doc.appendChild(rootElement); } settings.serialize(doc, rootElement); FileWriter writer = new FileWriter(file); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(writer); transformer.transform(source, result); writer.close(); } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (TransformerConfigurationException e) { } catch (TransformerException e) { } catch (IOException e) { } }
Base
1
private static CHelpSettings createHelpSettings(IProject project) { // String projectName = project.getName(); File file = getSettingsFile(); CHelpSettings settings = null; Element rootElement = null; if (file.isFile()) { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(file); NodeList nodes = doc.getElementsByTagName(ELEMENT_ROOT); if (nodes.getLength() > 0) rootElement = (Element) nodes.item(0); } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (IOException e) { } } settings = new CHelpSettings(project, rootElement); return settings; }
Base
1
private void loadFile(IConfigurationElement el, ArrayList<ICHelpBook> chbl, String pluginId) { String fname = el.getAttribute(ATTRIB_FILE); if (fname == null || fname.trim().length() == 0) return; URL x = FileLocator.find(Platform.getBundle(pluginId), new Path(fname), null); if (x == null) return; try { x = FileLocator.toFileURL(x); } catch (IOException e) { return; } fname = x.getPath(); if (fname == null || fname.trim().length() == 0) return; // format is not supported for now // String format = el.getAttribute(ATTRIB_FORMAT); Document doc = null; try { InputStream stream = new FileInputStream(fname); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); InputSource src = new InputSource(reader); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse(src); Element e = doc.getDocumentElement(); if (NODE_HEAD.equals(e.getNodeName())) { NodeList list = e.getChildNodes(); for (int j = 0; j < list.getLength(); j++) { Node node = list.item(j); if (node.getNodeType() != Node.ELEMENT_NODE) continue; if (NODE_BOOK.equals(node.getNodeName())) { chbl.add(new CHelpBook((Element) node)); } } } } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (IOException e) { } }
Base
1
private static void writeProfilesToStream(Collection<Profile> profiles, OutputStream stream, String encoding, IProfileVersioner profileVersioner) throws CoreException { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document document = builder.newDocument(); final Element rootElement = document.createElement(XML_NODE_ROOT); rootElement.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(profileVersioner.getCurrentVersion())); document.appendChild(rootElement); for (Object element : profiles) { final Profile profile = (Profile) element; if (profile.isProfileToSave()) { final Element profileElement = createProfileElement(profile, document, profileVersioner); rootElement.appendChild(profileElement); } } Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.ENCODING, encoding); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ transformer.transform(new DOMSource(document), new StreamResult(stream)); } catch (TransformerException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message); } catch (ParserConfigurationException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message); } }
Base
1
protected static List<Profile> readProfilesFromStream(InputSource inputSource) throws CoreException { final ProfileDefaultHandler handler = new ProfileDefaultHandler(); try { final SAXParserFactory factory = SAXParserFactory.newInstance(); final SAXParser parser = factory.newSAXParser(); parser.parse(inputSource, handler); } catch (SAXException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } catch (IOException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } catch (ParserConfigurationException e) { throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message); } return handler.getProfiles(); }
Base
1
private static Document parse(InputStream in) throws SettingsImportExportException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(false); factory.setIgnoringComments(true); try { DocumentBuilder parser = factory.newDocumentBuilder(); parser.setErrorHandler(ABORTING_ERROR_HANDER); // causes SAXException to be thrown on any parse error InputSource input = new InputSource(in); // TODO should I be using an InputSource? Document doc = parser.parse(input); return doc; } catch (Exception e) { throw new SettingsImportExportException(e); } }
Base
1
public static String serializeDocument(Document doc, boolean indent) throws IOException, TransformerException { ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, indent ? "yes" : "no"); //$NON-NLS-1$ //$NON-NLS-2$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); return s.toString("UTF8"); //$NON-NLS-1$ }
Base
1
private void loadActionData() { String actionData = CDebugCorePlugin.getDefault().getPluginPreferences().getString(BREAKPOINT_ACTION_DATA); if (actionData == null || actionData.length() == 0) return; Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(actionData))).getDocumentElement(); NodeList nodeList = root.getChildNodes(); int entryCount = nodeList.getLength(); for (int i = 0; i < entryCount; i++) { Node node = nodeList.item(i); short type = node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element subElement = (Element) node; String nodeName = subElement.getNodeName(); if (nodeName.equalsIgnoreCase("actionEntry")) { //$NON-NLS-1$ String name = subElement.getAttribute("name"); //$NON-NLS-1$ if (name == null) throw new Exception(); String value = subElement.getAttribute("value"); //$NON-NLS-1$ if (value == null) throw new Exception(); String className = subElement.getAttribute("class"); //$NON-NLS-1$ if (className == null) throw new Exception(); IBreakpointAction action = createActionFromClassName(name, className); action.initializeFromMemento(value); } } } } catch (Exception e) { e.printStackTrace(); } }
Base
1
public void saveActionData() { String actionData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("breakpointActionData"); //$NON-NLS-1$ doc.appendChild(rootElement); for (IBreakpointAction action : getBreakpointActions()) { Element element = doc.createElement("actionEntry"); //$NON-NLS-1$ element.setAttribute("name", action.getName()); //$NON-NLS-1$ element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$ element.setAttribute("value", action.getMemento()); //$NON-NLS-1$ rootElement.appendChild(element); } ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); actionData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } CDebugCorePlugin.getDefault().getPluginPreferences().setValue(BREAKPOINT_ACTION_DATA, actionData); CDebugCorePlugin.getDefault().savePluginPreferences(); }
Base
1
public String getMemento() throws CoreException { Document document = null; Throwable ex = null; try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element node = document.createElement(ELEMENT_NAME); document.appendChild(node); node.setAttribute(ATTR_DIRECTORY, getDirectory().toOSString()); if (getAssociation() != null) node.setAttribute(ATTR_ASSOCIATION, getAssociation().toOSString()); node.setAttribute(ATTR_SEARCH_SUBFOLDERS, String.valueOf(searchSubfolders())); return CDebugUtils.serializeDocument(document); } catch (ParserConfigurationException e) { ex = e; } catch (IOException e) { ex = e; } catch (TransformerException e) { ex = e; } abort(NLS.bind(InternalSourceLookupMessages.CDirectorySourceLocation_0, getDirectory().toOSString()), ex); // execution will not reach here return null; }
Base
1
public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String dir = root.getAttribute(ATTR_DIRECTORY); if (isEmpty(dir)) { abort(InternalSourceLookupMessages.CDirectorySourceLocation_1, null); } else { IPath path = new Path(dir); if (path.isValidPath(dir) && path.toFile().isDirectory() && path.toFile().exists()) { setDirectory(path); } else { abort(NLS.bind(InternalSourceLookupMessages.CDirectorySourceLocation_2, dir), null); } } dir = root.getAttribute(ATTR_ASSOCIATION); if (isEmpty(dir)) { setAssociation(null); } else { IPath path = new Path(dir); if (path.isValidPath(dir)) { setAssociation(path); } else { setAssociation(null); } } setSearchSubfolders(Boolean.valueOf(root.getAttribute(ATTR_SEARCH_SUBFOLDERS)).booleanValue()); return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(InternalSourceLookupMessages.CDirectorySourceLocation_3, ex); }
Base
1
public String getMemento() throws CoreException { Document document = null; Throwable ex = null; try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element node = document.createElement(ELEMENT_NAME); document.appendChild(node); node.setAttribute(ATTR_PROJECT, getProject().getName()); node.setAttribute(ATTR_GENERIC, String.valueOf(isGeneric())); return CDebugUtils.serializeDocument(document); } catch (ParserConfigurationException e) { ex = e; } catch (IOException e) { ex = e; } catch (TransformerException e) { ex = e; } abort(NLS.bind(InternalSourceLookupMessages.CProjectSourceLocation_0, getProject().getName()), ex); // execution will not reach here return null; }
Base
1
public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String name = root.getAttribute(ATTR_PROJECT); if (isEmpty(name)) { abort(InternalSourceLookupMessages.CProjectSourceLocation_1, null); } else { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); setProject(project); } String isGeneric = root.getAttribute(ATTR_GENERIC); if (isGeneric == null || isGeneric.trim().length() == 0) isGeneric = Boolean.FALSE.toString(); setGenerated(isGeneric.equals(Boolean.TRUE.toString())); return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(InternalSourceLookupMessages.CProjectSourceLocation_2, ex); }
Base
1
public void initializeFromMemento(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); if (!root.getNodeName().equalsIgnoreCase(SOURCE_LOCATOR_NAME)) { abort(InternalSourceLookupMessages.CSourceLocator_1, null); } List<ICSourceLocation> sourceLocations = new ArrayList<>(); // Add locations based on referenced projects IProject project = getProject(); if (project != null && project.exists() && project.isOpen()) sourceLocations.addAll(Arrays.asList(getDefaultSourceLocations())); removeDisabledLocations(root, sourceLocations); addAdditionalLocations(root, sourceLocations); // To support old launch configuration addOldLocations(root, sourceLocations); setSourceLocations(sourceLocations.toArray(new ICSourceLocation[sourceLocations.size()])); setSearchForDuplicateFiles(Boolean.valueOf(root.getAttribute(ATTR_DUPLICATE_FILES)).booleanValue()); return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(InternalSourceLookupMessages.CSourceLocator_2, ex); }
Base
1
public String getMemento() throws CoreException { Document document = null; Throwable ex = null; try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element node = document.createElement(SOURCE_LOCATOR_NAME); document.appendChild(node); ICSourceLocation[] locations = getSourceLocations(); saveDisabledGenericSourceLocations(locations, document, node); saveAdditionalSourceLocations(locations, document, node); node.setAttribute(ATTR_DUPLICATE_FILES, String.valueOf(searchForDuplicateFiles())); return CDebugUtils.serializeDocument(document); } catch (ParserConfigurationException e) { ex = e; } catch (IOException e) { ex = e; } catch (TransformerException e) { ex = e; } abort(InternalSourceLookupMessages.CSourceLocator_0, ex); // execution will not reach here return null; }
Base
1
public static ICSourceLocation[] getCommonSourceLocationsFromMemento(String memento) { ICSourceLocation[] result = new ICSourceLocation[0]; if (!isEmpty(memento)) { try { DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); Element root = parser.parse(source).getDocumentElement(); if (root.getNodeName().equalsIgnoreCase(NAME_COMMON_SOURCE_LOCATIONS)) result = initializeSourceLocations(root); } catch (ParserConfigurationException e) { CDebugCorePlugin.log(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error initializing common source settings.", e)); //$NON-NLS-1$ } catch (SAXException e) { CDebugCorePlugin.log(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error initializing common source settings.", e)); //$NON-NLS-1$ } catch (IOException e) { CDebugCorePlugin.log(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error initializing common source settings.", e)); //$NON-NLS-1$ } } return result; }
Base
1
public static String getCommonSourceLocationsMemento(ICSourceLocation[] locations) { Document document = null; Throwable ex = null; try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element element = document.createElement(NAME_COMMON_SOURCE_LOCATIONS); document.appendChild(element); saveSourceLocations(document, element, locations); return CDebugUtils.serializeDocument(document); } catch (ParserConfigurationException e) { ex = e; } catch (IOException e) { ex = e; } catch (TransformerException e) { ex = e; } CDebugCorePlugin.log(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error saving common source settings.", ex)); //$NON-NLS-1$ return null; }
Base
1
public String getMemento() { String executeData = ""; //$NON-NLS-1$ if (externalToolName != null) { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("launchConfigName"); //$NON-NLS-1$ rootElement.setAttribute("configName", externalToolName); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); executeData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } } return executeData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); String value = root.getAttribute("configName"); //$NON-NLS-1$ if (value == null) throw new Exception(); externalToolName = value; } catch (Exception e) { e.printStackTrace(); } }
Base
1
public String getMemento() { String logData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("logData"); //$NON-NLS-1$ rootElement.setAttribute("message", message); //$NON-NLS-1$ rootElement.setAttribute("evalExpr", Boolean.toString(evaluateExpression)); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); logData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } return logData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); String value = root.getAttribute("message"); //$NON-NLS-1$ if (value == null) throw new Exception(); message = value; value = root.getAttribute("evalExpr"); //$NON-NLS-1$ if (value == null) throw new Exception(); evaluateExpression = Boolean.valueOf(value).booleanValue(); value = root.getAttribute("resume"); //$NON-NLS-1$ if (value == null) throw new Exception(); } catch (Exception e) { e.printStackTrace(); } }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); String value = root.getAttribute("pauseTime"); //$NON-NLS-1$ if (value == null) throw new Exception(); pauseTime = Integer.parseInt(value); } catch (Exception e) { e.printStackTrace(); } }
Base
1
public String getMemento() { String resumeData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("resumeData"); //$NON-NLS-1$ rootElement.setAttribute("pauseTime", Integer.toString(pauseTime)); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); resumeData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } return resumeData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); String value = root.getAttribute("operation"); //$NON-NLS-1$ if (value == null) throw new Exception(); fOperation = REVERSE_DEBUG_ACTIONS_ENUM.valueOf(value); } catch (Exception e) { e.printStackTrace(); } }
Base
1
public String getMemento() { String reverseDebugData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("reverseDebugData"); //$NON-NLS-1$ rootElement.setAttribute("operation", fOperation.toString()); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); reverseDebugData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } return reverseDebugData; }
Base
1
public String getMemento() { String soundData = ""; //$NON-NLS-1$ if (soundFile != null) { DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("soundData"); //$NON-NLS-1$ rootElement.setAttribute("file", soundFile.getAbsolutePath()); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); soundData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } } return soundData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); String value = root.getAttribute("file"); //$NON-NLS-1$ if (value == null) throw new Exception(); soundFile = new File(value); } catch (Exception e) { e.printStackTrace(); } }
Base
1
private void loadRecentSounds() { String recentSoundData = CDebugUIPlugin.getDefault().getPreferenceStore().getString(SOUND_ACTION_RECENT); if (recentSoundData == null || recentSoundData.length() == 0) { initializeRecentSounds(); return; } recentSounds = new ArrayList<>(); Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(recentSoundData))).getDocumentElement(); NodeList nodeList = root.getChildNodes(); int entryCount = nodeList.getLength(); for (int i = 0; i < entryCount; i++) { Node node = nodeList.item(i); short type = node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element subElement = (Element) node; String nodeName = subElement.getNodeName(); if (nodeName.equalsIgnoreCase("soundFileName")) { //$NON-NLS-1$ String value = subElement.getAttribute("name"); //$NON-NLS-1$ if (value == null) throw new Exception(); File soundFile = new File(value); if (soundFile.exists()) { recentSounds.add(soundFile); } } } } } catch (Exception e) { e.printStackTrace(); } if (recentSounds.size() == 0) initializeRecentSounds(); }
Base
1
public void saveRecentSounds() { String recentSoundData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("recentSounds"); //$NON-NLS-1$ doc.appendChild(rootElement); for (Iterator<File> iter = recentSounds.iterator(); iter.hasNext();) { File soundFile = iter.next(); Element element = doc.createElement("soundFileName"); //$NON-NLS-1$ element.setAttribute("name", soundFile.getAbsolutePath()); //$NON-NLS-1$ rootElement.appendChild(element); } ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); recentSoundData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } CDebugUIPlugin.getDefault().getPreferenceStore().setValue(SOUND_ACTION_RECENT, recentSoundData); }
Base
1
public void initializeFromMemento(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); if (!root.getNodeName().equalsIgnoreCase(ELEMENT_NAME)) { abort(SourceLookupMessages.getString("OldDefaultSourceLocator.2"), null); //$NON-NLS-1$ } String projectName = root.getAttribute(ATTR_PROJECT); String data = root.getAttribute(ATTR_MEMENTO); if (isEmpty(projectName)) { abort(SourceLookupMessages.getString("OldDefaultSourceLocator.3"), null); //$NON-NLS-1$ } IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (getCSourceLocator() == null) setCSourceLocator(SourceLookupFactory.createSourceLocator(project)); if (getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals(project)) return; if (project == null || !project.exists() || !project.isOpen()) abort(MessageFormat.format(SourceLookupMessages.getString("OldDefaultSourceLocator.4"), //$NON-NLS-1$ new Object[] { projectName }), null); IPersistableSourceLocator psl = getPersistableSourceLocator(); if (psl != null) psl.initializeFromMemento(data); else abort(SourceLookupMessages.getString("OldDefaultSourceLocator.5"), null); //$NON-NLS-1$ return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(SourceLookupMessages.getString("OldDefaultSourceLocator.6"), ex); //$NON-NLS-1$ }
Base
1
public String getMemento() throws CoreException { if (getCSourceLocator() != null) { Document document = null; Throwable ex = null; try { document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element element = document.createElement(ELEMENT_NAME); document.appendChild(element); element.setAttribute(ATTR_PROJECT, getCSourceLocator().getProject().getName()); IPersistableSourceLocator psl = getPersistableSourceLocator(); if (psl != null) { element.setAttribute(ATTR_MEMENTO, psl.getMemento()); } return CDebugUtils.serializeDocument(document); } catch (ParserConfigurationException e) { ex = e; } catch (IOException e) { ex = e; } catch (TransformerException e) { ex = e; } abort(SourceLookupMessages.getString("OldDefaultSourceLocator.1"), ex); //$NON-NLS-1$ } return null; }
Base
1
public static Map<String, String> decodeMapFromMemento(String memento) { Map<String, String> keyPairValues = new HashMap<>(); Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(memento))).getDocumentElement(); NodeList nodeList = root.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) node; NamedNodeMap nodeMap = elem.getAttributes(); String key = null; String value = null; for (int idx = 0; idx < nodeMap.getLength(); idx++) { Node attrNode = nodeMap.item(idx); if (attrNode.getNodeType() == Node.ATTRIBUTE_NODE) { Attr attr = (Attr) attrNode; if (attr.getName().equals(ATTRIBUTE_KEY)) { key = attr.getValue(); } else if (attr.getName().equals(ATTRIBUTE_VALUE)) { value = attr.getValue(); } } } if (key != null && value != null) { keyPairValues.put(key, value); } else { throw new Exception(); } } } } catch (Exception e) { e.printStackTrace(); } return keyPairValues; }
Base
1
public static List<String> decodeListFromMemento(String memento) { List<String> list = new ArrayList<>(); Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(memento))).getDocumentElement(); NodeList nodeList = root.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) node; String value = elem.getAttribute(ATTRIBUTE_VALUE); if (value != null) { list.add(value); } else { throw new Exception(); } } } } catch (Exception e) { e.printStackTrace(); } return list; }
Base
1
public static String encodeListIntoMemento(List<String> labels) { String returnValue = null; DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement(ROOT_ELEMENT_TAGNAME); doc.appendChild(rootElement); // create one XML element per list entry to save for (String lbl : labels) { Element elem = doc.createElement(ELEMENT_TAGNAME); elem.setAttribute(ATTRIBUTE_VALUE, lbl); rootElement.appendChild(elem); } ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); returnValue = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } return returnValue; }
Base
1
public static String encodeMapIntoMemento(Map<String, String> keyPairValues) { String returnValue = null; DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement(ROOT_ELEMENT_TAGNAME); doc.appendChild(rootElement); // create one XML element per map entry for (String key : keyPairValues.keySet()) { Element elem = doc.createElement(ELEMENT_TAGNAME); // store key and value as values of 2 attributes elem.setAttribute(ATTRIBUTE_KEY, key); elem.setAttribute(ATTRIBUTE_VALUE, keyPairValues.get(key)); rootElement.appendChild(elem); } ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); returnValue = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } return returnValue; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); fCollectString = root.getAttribute(COLLECT_STRING_ATTR); if (fCollectString == null) fCollectString = ""; //$NON-NLS-1$ String asStrings = root.getAttribute(COLLECT_AS_STRING_ATTR); if (asStrings != null) { fCharPtrAsStrings = Boolean.valueOf(asStrings); } else { fCharPtrAsStrings = false; } fCharPtrAsStringsLimit = null; String asStringsLimit = root.getAttribute(COLLECT_AS_STRING_LIMIT_ATTR); if (asStringsLimit != null) { try { fCharPtrAsStringsLimit = Integer.valueOf(asStringsLimit); } catch (NumberFormatException e) { // leave as null to disable } } } catch (Exception e) { GdbPlugin.log(e); } }
Base
1
public String getMemento() { String collectData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement(COLLECT_ACTION_ELEMENT_NAME); // Store the different attributes of this collect action rootElement.setAttribute(COLLECT_STRING_ATTR, fCollectString); rootElement.setAttribute(COLLECT_AS_STRING_ATTR, Boolean.toString(fCharPtrAsStrings)); rootElement.setAttribute(COLLECT_AS_STRING_LIMIT_ATTR, fCharPtrAsStringsLimit == null ? "" : fCharPtrAsStringsLimit.toString()); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); collectData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { GdbPlugin.log(e); } return collectData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); fEvalString = root.getAttribute("evalString"); //$NON-NLS-1$ if (fEvalString == null) throw new Exception(); } catch (Exception e) { GdbPlugin.log(e); } }
Base
1
public String getMemento() { String collectData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("evalData"); //$NON-NLS-1$ rootElement.setAttribute("evalString", fEvalString); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); collectData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { GdbPlugin.log(e); } return collectData; }
Base
1
private void loadActionData() { String actionData = GdbPlugin.getDefault().getPluginPreferences().getString(TRACEPOINT_ACTION_DATA); if (actionData == null || actionData.length() == 0) return; Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(actionData))).getDocumentElement(); NodeList nodeList = root.getChildNodes(); int entryCount = nodeList.getLength(); for (int i = 0; i < entryCount; i++) { Node node = nodeList.item(i); short type = node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element subElement = (Element) node; String nodeName = subElement.getNodeName(); if (nodeName.equalsIgnoreCase("actionEntry")) { //$NON-NLS-1$ String name = subElement.getAttribute("name"); //$NON-NLS-1$ if (name == null) throw new Exception(); String value = subElement.getAttribute("value"); //$NON-NLS-1$ if (value == null) throw new Exception(); String className = subElement.getAttribute("class"); //$NON-NLS-1$ if (className == null) throw new Exception(); ITracepointAction action = (ITracepointAction) Class.forName(className).newInstance(); action.setName(name); action.initializeFromMemento(value); addAction(action); } } } } catch (Exception e) { e.printStackTrace(); } }
Base
1
public void saveActionData() { String actionData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("tracepointActionData"); //$NON-NLS-1$ doc.appendChild(rootElement); for (Iterator<ITracepointAction> iter = getActions().iterator(); iter.hasNext();) { ITracepointAction action = iter.next(); Element element = doc.createElement("actionEntry"); //$NON-NLS-1$ element.setAttribute("name", action.getName()); //$NON-NLS-1$ element.setAttribute("class", action.getClass().getName()); //$NON-NLS-1$ element.setAttribute("value", action.getMemento()); //$NON-NLS-1$ rootElement.appendChild(element); } ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); actionData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { e.printStackTrace(); } GdbPlugin.getDefault().getPluginPreferences().setValue(TRACEPOINT_ACTION_DATA, actionData); GdbPlugin.getDefault().savePluginPreferences(); }
Base
1
public String getMemento() { String collectData = ""; //$NON-NLS-1$ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = dfactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("whileSteppingData"); //$NON-NLS-1$ rootElement.setAttribute("whileSteppingCount", Integer.toString(fStepCount)); //$NON-NLS-1$ rootElement.setAttribute("subActionNames", fSubActionNames); //$NON-NLS-1$ doc.appendChild(rootElement); ByteArrayOutputStream s = new ByteArrayOutputStream(); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult outputTarget = new StreamResult(s); transformer.transform(source, outputTarget); collectData = s.toString("UTF8"); //$NON-NLS-1$ } catch (Exception e) { GdbPlugin.log(e); } return collectData; }
Base
1
public void initializeFromMemento(String data) { Element root = null; DocumentBuilder parser; try { parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement(); setStepCount(Integer.parseInt(root.getAttribute("whileSteppingCount"))); //$NON-NLS-1$ setSubActionsNames(root.getAttribute("subActionNames")); //$NON-NLS-1$ if (fSubActionNames == null) throw new Exception(); setSubActionsContent(fSubActionNames); } catch (Exception e) { GdbPlugin.log(e); } }
Base
1
public void run(ITestModelUpdater modelUpdater, InputStream inputStream) throws TestingException { try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); sp.parse(inputStream, new BoostXmlLogHandler(modelUpdater)); } catch (IOException e) { throw new TestingException( getErrorText(BoostTestsRunnerMessages.BoostTestsRunner_io_error_prefix, e.getLocalizedMessage())); } catch (NumberFormatException e) { throw new TestingException( getErrorText(BoostTestsRunnerMessages.BoostTestsRunner_xml_error_prefix, e.getLocalizedMessage())); } catch (ParserConfigurationException e) { throw new TestingException( getErrorText(BoostTestsRunnerMessages.BoostTestsRunner_xml_error_prefix, e.getLocalizedMessage())); } catch (SAXException e) { throw new TestingException( getErrorText(BoostTestsRunnerMessages.BoostTestsRunner_xml_error_prefix, e.getLocalizedMessage())); } }
Base
1
public void run(ITestModelUpdater modelUpdater, InputStream inputStream) throws TestingException { try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); sp.parse(inputStream, new QtXmlLogHandler(modelUpdater)); } catch (IOException e) { throw new TestingException( getErrorText(QtTestsRunnerMessages.QtTestsRunner_io_error_prefix, e.getLocalizedMessage())); } catch (ParserConfigurationException e) { throw new TestingException( getErrorText(QtTestsRunnerMessages.QtTestsRunner_xml_error_prefix, e.getLocalizedMessage())); } catch (SAXException e) { throw new TestingException( getErrorText(QtTestsRunnerMessages.QtTestsRunner_xml_error_prefix, e.getLocalizedMessage())); } }
Base
1
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { List<Class<?>> loadedClasses = new ArrayList<Class<?>>(interfaces.length); for (String name : interfaces) { Class<?> clazz = Class.forName(name, false, classLoader); loadedClasses.add(clazz); } return Proxy.getProxyClass(classLoader, loadedClasses.toArray(new Class[loadedClasses.size()])); }
Base
1
private final Decoder<Object> decoder = new Decoder<Object>() { @Override public Object decode(ByteBuf buf, State state) throws IOException { try { //set thread context class loader to be the classLoader variable as there could be reflection //done while reading from input stream which reflection will use thread class loader to load classes on demand ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader(); try { ByteBufInputStream in = new ByteBufInputStream(buf); ObjectInputStream inputStream; if (classLoader != null) { Thread.currentThread().setContextClassLoader(classLoader); inputStream = new CustomObjectInputStream(classLoader, in); } else { inputStream = new ObjectInputStream(in); } return inputStream.readObject(); } finally { Thread.currentThread().setContextClassLoader(currentThreadClassLoader); } } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(e); } } };
Base
1
protected synchronized FrameHandlerFactory createFrameHandlerFactory() throws IOException { if(nio) { if(this.frameHandlerFactory == null) { if(this.nioParams.getNioExecutor() == null && this.nioParams.getThreadFactory() == null) { this.nioParams.setThreadFactory(getThreadFactory()); } this.frameHandlerFactory = new SocketChannelFrameHandlerFactory(connectionTimeout, nioParams, isSSL(), sslContextFactory); } return this.frameHandlerFactory; } else { return new SocketFrameHandlerFactory(connectionTimeout, socketFactory, socketConf, isSSL(), this.shutdownExecutor, sslContextFactory); } }
Class
2
public void handleFrame(Frame frame) throws IOException { AMQCommand command = _command; if (command.handleFrame(frame)) { // a complete command has rolled off the assembly line _command = new AMQCommand(); // prepare for the next one handleCompleteInboundCommand(command); } }
Class
2
public AMQCommand(com.rabbitmq.client.Method method) { this(method, null, null); }
Class
2
public AMQCommand() { this(null, null, null); }
Class
2
public AMQCommand(com.rabbitmq.client.Method method, AMQContentHeader contentHeader, byte[] body) { this.assembler = new CommandAssembler((Method) method, contentHeader, body); }
Class
2
protected AbstractFrameHandlerFactory(int connectionTimeout, SocketConfigurator configurator, boolean ssl) { this.connectionTimeout = connectionTimeout; this.configurator = configurator; this.ssl = ssl; }
Class
2
public CommandAssembler(Method method, AMQContentHeader contentHeader, byte[] body) { this.method = method; this.contentHeader = contentHeader; this.bodyN = new ArrayList<byte[]>(2); this.bodyLength = 0; this.remainingBodyBytes = 0; appendBodyFragment(body); if (method == null) { this.state = CAState.EXPECTING_METHOD; } else if (contentHeader == null) { this.state = method.hasContent() ? CAState.EXPECTING_CONTENT_HEADER : CAState.COMPLETE; } else { this.remainingBodyBytes = contentHeader.getBodySize() - this.bodyLength; updateContentBodyState(); } }
Class
2
private void consumeHeaderFrame(Frame f) throws IOException { if (f.type == AMQP.FRAME_HEADER) { this.contentHeader = AMQImpl.readContentHeaderFrom(f.getInputStream()); this.remainingBodyBytes = this.contentHeader.getBodySize(); updateContentBodyState(); } else { throw new UnexpectedFrameError(f, AMQP.FRAME_HEADER); } }
Class
2
public static Frame readFrom(DataInputStream is) throws IOException { int type; int channel; try { type = is.readUnsignedByte(); } catch (SocketTimeoutException ste) { // System.err.println("Timed out waiting for a frame."); return null; // failed } if (type == 'A') { /* * Probably an AMQP.... header indicating a version * mismatch. */ /* * Otherwise meaningless, so try to read the version, * and throw an exception, whether we read the version * okay or not. */ protocolVersionMismatch(is); } channel = is.readUnsignedShort(); int payloadSize = is.readInt(); byte[] payload = new byte[payloadSize]; is.readFully(payload); int frameEndMarker = is.readUnsignedByte(); if (frameEndMarker != AMQP.FRAME_END) { throw new MalformedFrameException("Bad frame end marker: " + frameEndMarker); } return new Frame(type, channel, payload); }
Class
2
public SocketFrameHandler(Socket socket, ExecutorService shutdownExecutor) throws IOException { _socket = socket; _shutdownExecutor = shutdownExecutor; _inputStream = new DataInputStream(new BufferedInputStream(socket.getInputStream())); _outputStream = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); }
Class
2
public Frame readFrame() throws IOException { synchronized (_inputStream) { return Frame.readFrom(_inputStream); } }
Class
2
public SocketFrameHandler(Socket socket) throws IOException { this(socket, null); }
Class
2
public SocketFrameHandlerFactory(int connectionTimeout, SocketFactory socketFactory, SocketConfigurator configurator, boolean ssl, ExecutorService shutdownExecutor) { this(connectionTimeout, socketFactory, configurator, ssl, shutdownExecutor, null); }
Class
2
public FrameHandler create(Socket sock) throws IOException { return new SocketFrameHandler(sock, this.shutdownExecutor); }
Class
2
public SocketFrameHandlerFactory(int connectionTimeout, SocketFactory socketFactory, SocketConfigurator configurator, boolean ssl, ExecutorService shutdownExecutor, SslContextFactory sslContextFactory) { super(connectionTimeout, configurator, ssl); this.socketFactory = socketFactory; this.shutdownExecutor = shutdownExecutor; this.sslContextFactory = sslContextFactory; }
Class
2
public FrameBuilder(ReadableByteChannel channel, ByteBuffer buffer) { this.channel = channel; this.applicationBuffer = buffer; }
Class
2
public SocketChannelFrameHandlerFactory(int connectionTimeout, NioParams nioParams, boolean ssl, SslContextFactory sslContextFactory) { super(connectionTimeout, null, ssl); this.nioParams = new NioParams(nioParams); this.sslContextFactory = sslContextFactory; this.nioLoopContexts = new ArrayList<>(this.nioParams.getNbIoThreads()); for (int i = 0; i < this.nioParams.getNbIoThreads(); i++) { this.nioLoopContexts.add(new NioLoopContext(this, this.nioParams)); } }
Class
2
public SocketChannelFrameHandlerState(SocketChannel channel, NioLoopContext nioLoopsState, NioParams nioParams, SSLEngine sslEngine) { this.channel = channel; this.readSelectorState = nioLoopsState.readSelectorState; this.writeSelectorState = nioLoopsState.writeSelectorState; NioContext nioContext = new NioContext(nioParams, sslEngine); this.writeQueue = nioParams.getWriteQueueFactory() == null ? NioParams.DEFAULT_WRITE_QUEUE_FACTORY.apply(nioContext) : nioParams.getWriteQueueFactory().apply(nioContext); this.sslEngine = sslEngine; if(this.sslEngine == null) { this.ssl = false; this.plainOut = nioLoopsState.writeBuffer; this.cipherOut = null; this.plainIn = nioLoopsState.readBuffer; this.cipherIn = null; this.outputStream = new DataOutputStream( new ByteBufferOutputStream(channel, plainOut) ); this.frameBuilder = new FrameBuilder(channel, plainIn); } else { this.ssl = true; this.plainOut = nioParams.getByteBufferFactory().createWriteBuffer(nioContext); this.cipherOut = nioParams.getByteBufferFactory().createEncryptedWriteBuffer(nioContext); this.plainIn = nioParams.getByteBufferFactory().createReadBuffer(nioContext); this.cipherIn = nioParams.getByteBufferFactory().createEncryptedReadBuffer(nioContext); this.outputStream = new DataOutputStream( new SslEngineByteBufferOutputStream(sslEngine, plainOut, cipherOut, channel) ); this.frameBuilder = new SslEngineFrameBuilder(sslEngine, plainIn, cipherIn, channel); } }
Class
2
public SslEngineFrameBuilder(SSLEngine sslEngine, ByteBuffer plainIn, ByteBuffer cipherIn, ReadableByteChannel channel) { super(channel, plainIn); this.sslEngine = sslEngine; this.cipherBuffer = cipherIn; }
Class
2
public void buildFrameInSeveralCalls() throws IOException { buffer = ByteBuffer.wrap(new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2 }); builder = new FrameBuilder(channel, buffer); Frame frame = builder.readFrame(); assertThat(frame).isNull(); buffer.clear(); buffer.put(b(3)).put(end()); buffer.flip(); frame = builder.readFrame(); assertThat(frame).isNotNull(); assertThat(frame.type).isEqualTo(1); assertThat(frame.channel).isEqualTo(0); assertThat(frame.getPayload()).hasSize(3); }
Class
2
public void buildFrameInOneGo() throws IOException { buffer = ByteBuffer.wrap(new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2, 3, end() }); builder = new FrameBuilder(channel, buffer); Frame frame = builder.readFrame(); assertThat(frame).isNotNull(); assertThat(frame.type).isEqualTo(1); assertThat(frame.channel).isEqualTo(0); assertThat(frame.getPayload()).hasSize(3); }
Class
2
public void protocolMismatchHeader() throws IOException { ByteBuffer[] buffers = new ByteBuffer[] { ByteBuffer.wrap(new byte[] { 'A' }), ByteBuffer.wrap(new byte[] { 'A', 'M', 'Q' }), ByteBuffer.wrap(new byte[] { 'A', 'N', 'Q', 'P' }), ByteBuffer.wrap(new byte[] { 'A', 'M', 'Q', 'P' }), ByteBuffer.wrap(new byte[] { 'A', 'M', 'Q', 'P', 1, 1, 8 }), ByteBuffer.wrap(new byte[] { 'A', 'M', 'Q', 'P', 1, 1, 8, 0 }), ByteBuffer.wrap(new byte[] { 'A', 'M', 'Q', 'P', 1, 1, 9, 1 }) }; String[] messages = new String[] { "Invalid AMQP protocol header from server: read only 1 byte(s) instead of 4", "Invalid AMQP protocol header from server: read only 3 byte(s) instead of 4", "Invalid AMQP protocol header from server: expected character 77, got 78", "Invalid AMQP protocol header from server", "Invalid AMQP protocol header from server", "AMQP protocol version mismatch; we are version 0-9-1, server is 0-8", "AMQP protocol version mismatch; we are version 0-9-1, server sent signature 1,1,9,1" }; for (int i = 0; i < buffers.length; i++) { builder = new FrameBuilder(channel, buffers[i]); try { builder.readFrame(); fail("protocol header not correct, exception should have been thrown"); } catch (MalformedFrameException e) { assertThat(e.getMessage()).isEqualTo(messages[i]); } } }
Class
2
public void buildFramesInOneGo() throws IOException { byte[] frameContent = new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2, 3, end() }; int nbFrames = 13; byte[] frames = new byte[frameContent.length * nbFrames]; for (int i = 0; i < nbFrames; i++) { for (int j = 0; j < frameContent.length; j++) { frames[i * frameContent.length + j] = frameContent[j]; } } buffer = ByteBuffer.wrap(frames); builder = new FrameBuilder(channel, buffer); int frameCount = 0; Frame frame; while ((frame = builder.readFrame()) != null) { assertThat(frame).isNotNull(); assertThat(frame.type).isEqualTo(1); assertThat(frame.channel).isEqualTo(0); assertThat(frame.getPayload()).hasSize(3); frameCount++; } assertThat(frameCount).isEqualTo(nbFrames); }
Class
2
protected DocumentBuilder getDocumentBuilder( ) throws ServiceException { DocumentBuilder documentBuilder = null; DocumentBuilderFactory documentBuilderFactory = null; try { documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new ServiceException(e); } return documentBuilder; }
Base
1
public static void unzip(InputStream is, File dest) throws IOException { try (ZipInputStream zis = new ZipInputStream(is)) { ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { String name = entry.getName(); File file = new File(dest, name); if (entry.isDirectory()) { FileUtils.forceMkdir(file); } else { File parentFile = file.getParentFile(); FileUtils.forceMkdir(parentFile); try (OutputStream os = Files.newOutputStream(file.toPath())) { IOUtils.copy(zis, os); } } } } }
Base
1
private static void addExtraKexAlgorithms(CryptoWishList cwl) { String[] oldKexAlgorithms = cwl.kexAlgorithms; List<String> kexAlgorithms = new ArrayList<>(oldKexAlgorithms.length + 1); for (String algo : oldKexAlgorithms) { if (!algo.equals(EXT_INFO_C)) kexAlgorithms.add(algo); } kexAlgorithms.add(EXT_INFO_C); cwl.kexAlgorithms = kexAlgorithms.toArray(new String[0]); }
Base
1
public void configAviatorEvaluator() { // 配置AviatorEvaluator使用LRU缓存编译后的表达式 AviatorEvaluator.getInstance() .useLRUExpressionCache(AVIATOR_LRU_CACHE_SIZE) .addFunction(new StrEqualFunction()); // 配置自定义aviator函数 AviatorEvaluator.getInstance().addOpFunction(OperatorType.BIT_OR, new AbstractFunction() { @Override public AviatorObject call(final Map<String, Object> env, final AviatorObject arg1, final AviatorObject arg2) { try { Object value1 = arg1.getValue(env); Object value2 = arg2.getValue(env); Object currentValue = value1 == null ? value2 : value1; if (arg1.getAviatorType() == AviatorType.String) { return new AviatorString(String.valueOf(currentValue)); } else { return AviatorDouble.valueOf(currentValue); } } catch (Exception e) { log.error(e.getMessage()); } return arg1.bitOr(arg2, env); } @Override public String getName() { return OperatorType.BIT_OR.getToken(); } }); AviatorEvaluator.getInstance().addFunction(new StrContainsFunction()); AviatorEvaluator.getInstance().addFunction(new ObjectExistsFunction()); AviatorEvaluator.getInstance().addFunction(new StrMatchesFunction()); }
Base
1
public R update(FriendLinkDO friendLink) { friendLinkService.update(friendLink); redisTemplate.delete(CacheKey.INDEX_LINK_KEY); return R.ok(); }
Base
1
public R save(FriendLinkDO friendLink) { if (friendLinkService.save(friendLink) > 0) { redisTemplate.delete(CacheKey.INDEX_LINK_KEY); return R.ok(); } return R.error(); }
Base
1
public Integer getIsOpen() { return isOpen; }
Base
1
public void setLinkName(String linkName) { this.linkName = linkName; }
Base
1
public void setCreateUserId(Long createUserId) { this.createUserId = createUserId; }
Base
1
public Date getCreateTime() { return createTime; }
Base
1
public void setUpdateUserId(Long updateUserId) { this.updateUserId = updateUserId; }
Base
1
public Integer getId() { return id; }
Base
1
public String getLinkName() { return linkName; }
Base
1
public Date getUpdateTime() { return updateTime; }
Base
1