List of usage examples for org.apache.commons.configuration PropertiesConfiguration containsKey
public boolean containsKey(String key)
From source file:org.roqmessaging.management.config.internal.FileConfigurationReader.java
/** * @param file//from w w w. ja v a 2 s. c o m * the HCM property file * @return the HCM dao for properties * @throws ConfigurationException */ public HostConfigDAO loadHCMConfiguration(String file) throws ConfigurationException { // 1. Define the DAO HostConfigDAO configDao = new HostConfigDAO(); // 2. Load the file try { PropertiesConfiguration config = new PropertiesConfiguration(); config.load(file); // 3. Set the properties configDao.setGcmAddress(config.getString("gcm.address") != null ? config.getString("gcm.address") : configDao.getGcmAddress()); configDao.setExchangeFrontEndPort(config.getInt("exchange.base.port")); configDao.setMonitorBasePort(config.getInt("monitor.base.port")); configDao.setStatMonitorBasePort(config.getInt("statmonitor.base.port")); configDao.setStatPeriod(config.getInt("monitor.stat.period")); configDao.setMaxNumberEchanges(config.getInt("exchange.max.perhost")); configDao.setQueueInHcmVm(config.getBoolean("queue.hcm.vm")); configDao.setExchangeInHcmVm(config.getBoolean("exchange.hcm.vm")); configDao.setExchangeHeap( config.getInt("exchange.vm.heap") != -1 ? config.getInt("exchange.vm.heap") : 256); if (config.containsKey("network.interface")) configDao.setNetworkInterface(config.getString("network.interface")); } catch (Exception configE) { logger.error("Error while reading configuration file - skipped but set the default configuration", configE); } return configDao; }
From source file:org.sakuli.utils.SakuliPropertyPlaceholderConfigurer.java
@PreDestroy public void restoreProperties() { try {/*w w w.java 2 s . c o m*/ for (Map.Entry<String, Map<String, Object>> entry : modifiedSahiConfigProps.entrySet()) { String propFile = entry.getKey(); logger.debug("restore properties file '{}' with properties '{}'", propFile, entry.getValue()); PropertiesConfiguration propConfig = new PropertiesConfiguration(propFile); propConfig.setAutoSave(true); for (Map.Entry<String, Object> propEntry : entry.getValue().entrySet()) { String propKey = propEntry.getKey(); if (propConfig.containsKey(propKey)) { propConfig.clearProperty(propKey); } propConfig.addProperty(propKey, propEntry.getValue()); } } } catch (ConfigurationException e) { logger.error("Error in restore sahi config properties", e); } }
From source file:org.sakuli.utils.SakuliPropertyPlaceholderConfigurer.java
/** * writes the {@link SahiProxyProperties#PROXY_PORT} value as {@link SahiProxyProperties#SAHI_PROPERTY_PROXY_PORT_MAPPING} * property to sahiConfigPropertyFilePath! *//*from w w w . j av a 2 s. c om*/ protected void modifySahiProxyPortPropertiesConfiguration(String sahiConfigPropertyFilePath, Properties props) { final String sahiProxyPort = props.getProperty(SahiProxyProperties.PROXY_PORT); if (sahiProxyPort != null) { try { PropertiesConfiguration propConfig = new PropertiesConfiguration(sahiConfigPropertyFilePath); propConfig.setAutoSave(true); final String sahiMappingPropertyProxyPort = SahiProxyProperties.SAHI_PROPERTY_PROXY_PORT_MAPPING; if (propConfig.containsKey(sahiMappingPropertyProxyPort)) { propConfig.clearProperty(sahiMappingPropertyProxyPort); } //remove property after the test execution, so that the installation can't break addToModifiedPropertiesMap(sahiConfigPropertyFilePath, sahiMappingPropertyProxyPort, null); propConfig.addProperty(sahiMappingPropertyProxyPort, sahiProxyPort); logger.debug("modify properties file '{}' with '{}={}'", sahiConfigPropertyFilePath, sahiMappingPropertyProxyPort, sahiProxyPort); } catch (ConfigurationException e) { logger.error("modify sahi properties went wrong", e); } } }
From source file:org.sakuli.utils.SakuliPropertyPlaceholderConfigurer.java
/** * Modifies the properties file 'propFilePathToConfig' with assigned key from the resource properties. *///from w w w . ja v a 2s .c om protected void modifyPropertiesConfiguration(String propFilePathToConfig, List<String> updateKeys, Properties resourceProps) { try { PropertiesConfiguration propConfig = new PropertiesConfiguration(propFilePathToConfig); propConfig.setAutoSave(true); Properties temProps = new Properties(); for (String propKey : updateKeys) { String resolve = resolve(resourceProps.getProperty(propKey), resourceProps); if (resolve != null) { if (propConfig.containsKey(propKey)) { addToModifiedPropertiesMap(propFilePathToConfig, propKey, propConfig.getProperty(propKey)); propConfig.clearProperty(propKey); } temProps.put(propKey, resolve); propConfig.addProperty(propKey, resolve); } } logger.debug("modify properties file '{}' with '{}'", propFilePathToConfig, temProps.toString()); } catch (ConfigurationException e) { logger.error("modify sahi properties went wrong", e); } }
From source file:org.silverpeas.settings.file.ModifProperties.java
/** * lance la modification du fichier properties * @throws Exception//from w ww .j a v a 2s . co m */ @Override public void executeModification() throws Exception { File file = new File(path); if (file.exists()) { PropertiesConfiguration configuration = new PropertiesConfiguration(file); for (ElementModif em : listeModifications) { if (configuration.containsKey(em.getSearch())) { if (!em.getModif().equals(configuration.getProperty(em.getSearch()))) { if (!isModified) { isModified = true; BackupFile bf = new BackupFile(new File(path)); bf.makeBackup(); } configuration.setProperty(em.getSearch(), em.getModif()); } } else { configuration.setProperty(em.getSearch(), em.getModif()); } } configuration.save(file); } else { throw new Exception("ATTENTION le fichier:" + path + " n'existe pas"); } }
From source file:org.w3.i18n.I18nTestRunnerTest.java
private static List<I18nTest> interpretTests(String prefix, PropertiesConfiguration configuration) throws TestsFileParsingException { List<I18nTest> i18nTests = new ArrayList<>(); /* Possible properties for a test: * (name)//from w w w . j a v a 2 s . co m * 'id' * 'url' * 'test_for' * 'info_charset' * 'info_lang' * 'info_dir' * 'info_classId' * 'info_headers' * 'reports' * 'warning' * 'applicableOnlyTo' */ // Retrieve required details from the properties files. String propertyDescription = configuration.containsKey(prefix) ? configuration.getString(prefix).replace("\"", "") : null; String propertyId = configuration.containsKey(prefix + "_id") ? configuration.getString(prefix + "_id").replace("\"", "") : null; String propertyUrl = configuration.containsKey(prefix + "_url") ? configuration.getString(prefix + "_url").replace("\"", "") : null; String propertyTestFor = configuration.containsKey(prefix + "_test_for") ? configuration.getString(prefix + "_test_for") : null; String[] propertyReport = configuration.containsKey(prefix + "_report[]") ? configuration.getStringArray(prefix + "_report[]") : null; if (propertyReport == null) { String singlePropertyReport = configuration.containsKey(prefix + "_report") ? configuration.getString(prefix + "_report") : null; if (singlePropertyReport != null) { propertyReport = new String[] { singlePropertyReport }; } } // Check that vital details are set ('_testFor' and '_report[]'). boolean useableTest = propertyTestFor != null && !propertyTestFor.isEmpty() && propertyReport != null && propertyReport.length != 0; // Check that there's at least one non-empty report definition. if (useableTest) { propertyTestFor = propertyTestFor.replaceAll("\"", ""); if (propertyTestFor.isEmpty()) { useableTest = false; } } if (useableTest) { // Check that there's at least one non-empty report definition. useableTest = true; int i = 0; while (i < propertyReport.length) { propertyReport[i] = propertyReport[i].replace("\"", ""); if (propertyReport[i].isEmpty()) { useableTest = false; } i++; } } if (useableTest) { // Validate the given URL if present. URL givenUrl = null; if (propertyUrl != null) { try { givenUrl = new URL(propertyUrl); } catch (MalformedURLException ex) { throw new TestsFileParsingException("Invalid URL given" + " by property. Propety name: \"" + prefix + "_url\", extracted URL: " + propertyUrl + ", file: '" + configuration.getFileName() + "'.", ex); } } // Create a list of assertions from the expected reports. List<Assertion> expectedAssertions = new ArrayList<>(); for (String report : propertyReport) { if (!report.isEmpty()) { report = report.replace("}", ""); String[] reportSplit = report.replace("}", "").split("\\{"); String reportId = reportSplit[0]; // MESSAGE levels are not compared. Assertion.Level level = Assertion.Level.MESSAGE; /* Look for additional details for each '_report[]' * (e.g. "{severity:warning,tags:2}"). */ if (reportSplit.length != 1) { String[] details = reportSplit[1].split(","); for (String detail : details) { switch (detail.trim()) { case "severity:info": level = Assertion.Level.INFO; break; case "severity:warning": level = Assertion.Level.WARNING; break; case "severity:error": level = Assertion.Level.ERROR; break; } } } expectedAssertions.add(new Assertion(reportId, level, "", "", new ArrayList<String>())); } } if (expectedAssertions.isEmpty()) { throw new TestsFileParsingException("Could not create any Assertions from the reports" + " property for \"" + prefix + "\". Interpreted" + " reports property: " + Arrays.toString(propertyReport) + ", file: '" + configuration.getFileName() + "'."); } Collections.sort(expectedAssertions); // Prepare URLs and create I18nTests for each format and servaAs. for (String testFor : propertyTestFor.split(",")) { testFor = testFor.replace("\"", ""); String[] testForSplit = testFor.split(":"); String format = testForSplit[0]; String serveAs = testForSplit.length != 1 ? testForSplit[1] : "html"; URL testUrl; if (givenUrl == null) { try { testUrl = assembleTestUrl(propertyId, format, serveAs); } catch (MalformedURLException ex) { throw new TestsFileParsingException("Could not" + " construct a URL from testFor property." + " TestConfig.TEST_RUNNER_URL: " + TestConfig.TEST_RUNNER_URL + ", propety name:" + " \"" + prefix + "_test_for\", file: '" + configuration.getFileName() + "'.", ex); } } else { testUrl = givenUrl; } i18nTests.add(new I18nTest(prefix, propertyDescription, propertyId, testUrl, format, serveAs, expectedAssertions)); } } return i18nTests; }
From source file:org.xwiki.contrib.confluence.filter.internal.input.ConfluenceConverterListener.java
private LocalDocumentReference fromPageId(String id) throws NumberFormatException, ConfigurationException { // Document name PropertiesConfiguration pageProperties = this.confluencePackage.getPageProperties(Long.valueOf(id), false); if (pageProperties != null) { String documentName;/*from ww w . j ava 2 s .c o m*/ if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_HOMEPAGE)) { documentName = this.properties.getSpacePageName(); } else { documentName = pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_TITLE); } // Space name Long spaceId = pageProperties.getLong("space", null); String spaceKey = this.confluencePackage.getSpaceKey(spaceId); // Reference return new LocalDocumentReference(spaceKey, documentName); } return null; }
From source file:org.xwiki.contrib.confluence.filter.internal.input.ConfluenceInputFilterStream.java
@Override protected void read(Object filter, ConfluenceFilter proxyFilter) throws FilterException { // Prepare package try {/*from w ww.j a v a2 s . c o m*/ this.confluencePackage = new ConfluenceXMLPackage(this.properties.getSource()); } catch (Exception e) { throw new FilterException("Failed to read package", e); } // Generate users events for (long userInt : this.confluencePackage.getUsers()) { PropertiesConfiguration userProperties; try { userProperties = this.confluencePackage.getUserProperties(userInt); } catch (ConfigurationException e) { throw new FilterException("Failed to get user properties", e); } String userId = userProperties.getString(ConfluenceXMLPackage.KEY_USER_NAME, String.valueOf(userInt)); if (this.properties.isConvertToXWiki() && userId.equals("admin")) { userId = "Admin"; } FilterEventParameters userParameters = new FilterEventParameters(); userParameters.put(UserFilter.PARAMETER_FIRSTNAME, userProperties.getString(ConfluenceXMLPackage.KEY_USER_FIRSTNAME)); userParameters.put(UserFilter.PARAMETER_LASTNAME, userProperties.getString(ConfluenceXMLPackage.KEY_USER_LASTNAME)); userParameters.put(UserFilter.PARAMETER_EMAIL, userProperties.getString(ConfluenceXMLPackage.KEY_USER_EMAIL)); userParameters.put(UserFilter.PARAMETER_ACTIVE, userProperties.getBoolean(ConfluenceXMLPackage.KEY_USER_ACTIVE)); try { userParameters.put(UserFilter.PARAMETER_REVISION_DATE, this.confluencePackage .getDate(userProperties, ConfluenceXMLPackage.KEY_USER_REVISION_DATE)); userParameters.put(UserFilter.PARAMETER_CREATION_DATE, this.confluencePackage .getDate(userProperties, ConfluenceXMLPackage.KEY_USER_CREATION_DATE)); } catch (ParseException e) { if (this.properties.isVerbose()) { this.logger.error("Failed to parse date", e); } } // TODO: no idea how to import/convert the password, probably salted with the Confluence instance id // > User proxyFilter.beginUser(userId, userParameters); // < User proxyFilter.endUser(userId, userParameters); } // Generate users events for (long groupInt : this.confluencePackage.getGroups()) { PropertiesConfiguration groupProperties; try { groupProperties = this.confluencePackage.getGroupProperties(groupInt); } catch (ConfigurationException e) { throw new FilterException("Failed to get group properties", e); } String groupName = groupProperties.getString(ConfluenceXMLPackage.KEY_GROUP_NAME, String.valueOf(groupInt)); if (this.properties.isConvertToXWiki()) { if (groupName.equals("confluence-administrators")) { groupName = "XWikiAdminGroup"; } else if (groupName.equals("confluence-users")) { groupName = "XWikiAllGroup"; } } FilterEventParameters groupParameters = new FilterEventParameters(); try { groupParameters.put(GroupFilter.PARAMETER_REVISION_DATE, this.confluencePackage .getDate(groupProperties, ConfluenceXMLPackage.KEY_GROUP_REVISION_DATE)); groupParameters.put(GroupFilter.PARAMETER_CREATION_DATE, this.confluencePackage .getDate(groupProperties, ConfluenceXMLPackage.KEY_GROUP_CREATION_DATE)); } catch (ParseException e) { if (this.properties.isVerbose()) { this.logger.error("Failed to parse date", e); } } // > Group proxyFilter.beginGroupContainer(groupName, groupParameters); // Members users if (groupProperties.containsKey(ConfluenceXMLPackage.KEY_GROUP_MEMBERUSERS)) { List<Long> users = this.confluencePackage.getLongList(groupProperties, ConfluenceXMLPackage.KEY_GROUP_MEMBERUSERS); for (Long memberInt : users) { FilterEventParameters memberParameters = new FilterEventParameters(); try { String memberId = this.confluencePackage.getUserProperties(memberInt) .getString(ConfluenceXMLPackage.KEY_USER_NAME, String.valueOf(memberInt)); if (this.properties.isConvertToXWiki() && memberId.equals("admin")) { memberId = "Admin"; } proxyFilter.onGroupMemberGroup(memberId, memberParameters); } catch (ConfigurationException e) { this.logger.error("Failed to get user properties", e); } } } // Members groups if (groupProperties.containsKey(ConfluenceXMLPackage.KEY_GROUP_MEMBERGROUPS)) { List<Long> groups = this.confluencePackage.getLongList(groupProperties, ConfluenceXMLPackage.KEY_GROUP_MEMBERGROUPS); for (Long memberInt : groups) { FilterEventParameters memberParameters = new FilterEventParameters(); try { String memberId = this.confluencePackage.getGroupProperties(memberInt) .getString(ConfluenceXMLPackage.KEY_GROUP_NAME, String.valueOf(memberInt)); if (this.properties.isConvertToXWiki()) { if (memberId.equals("confluence-administrators")) { memberId = "XWikiAdminGroup"; } else if (memberId.equals("confluence-users")) { memberId = "XWikiAllGroup"; } } proxyFilter.onGroupMemberGroup(memberId, memberParameters); } catch (ConfigurationException e) { this.logger.error("Failed to get group properties", e); } } } // < Group proxyFilter.endGroupContainer(groupName, groupParameters); } // Generate documents events for (Map.Entry<Long, List<Long>> entry : this.confluencePackage.getPages().entrySet()) { long spaceId = entry.getKey(); PropertiesConfiguration spaceProperties; try { spaceProperties = this.confluencePackage.getSpaceProperties(spaceId); } catch (ConfigurationException e) { throw new FilterException("Failed to get space properties", e); } String spaceKey = ConfluenceXMLPackage.getSpaceKey(spaceProperties); FilterEventParameters spaceParameters = new FilterEventParameters(); // > WikiSpace proxyFilter.beginWikiSpace(spaceKey, spaceParameters); // Main page Long descriptionId = spaceProperties.getLong(ConfluenceXMLPackage.KEY_SPACE_DESCRIPTION, null); if (descriptionId != null) { readPage(descriptionId, filter, proxyFilter); } // Other pages for (long pageId : entry.getValue()) { readPage(pageId, filter, proxyFilter); } // < WikiSpace proxyFilter.endWikiSpace(spaceKey, spaceParameters); } // Cleanup try { this.confluencePackage.close(); } catch (IOException e) { throw new FilterException("Failed to close package", e); } }
From source file:org.xwiki.contrib.confluence.filter.internal.input.ConfluenceInputFilterStream.java
private void readPage(long pageId, Object filter, ConfluenceFilter proxyFilter) throws FilterException { PropertiesConfiguration pageProperties = getPageProperties(pageId); if (pageProperties == null) { this.logger.warn("Can't find page with id [{}]", pageId); return;/* w w w . j ava 2s . c om*/ } String documentName; if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_HOMEPAGE)) { documentName = this.properties.getSpacePageName(); } else { documentName = pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_TITLE); } if (StringUtils.isEmpty(documentName)) { this.logger.warn("Found a page without name of title (id={}). Skipping it.", pageId); return; } FilterEventParameters documentParameters = new FilterEventParameters(); if (this.properties.getDefaultLocale() != null) { documentParameters.put(WikiDocumentFilter.PARAMETER_LOCALE, this.properties.getDefaultLocale()); } // We should not imported pages from the Trash if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_CONTENT_STATUS)) { String contentStatus = pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_CONTENT_STATUS); if (contentStatus.equals("deleted")) return; } // > WikiDocument proxyFilter.beginWikiDocument(documentName, documentParameters); Locale locale = Locale.ROOT; FilterEventParameters documentLocaleParameters = new FilterEventParameters(); if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_CREATION_AUTHOR)) { documentLocaleParameters.put(WikiDocumentFilter.PARAMETER_CREATION_AUTHOR, pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_CREATION_AUTHOR)); } if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_CREATION_DATE)) { try { documentLocaleParameters.put(WikiDocumentFilter.PARAMETER_CREATION_DATE, this.confluencePackage .getDate(pageProperties, ConfluenceXMLPackage.KEY_PAGE_CREATION_DATE)); } catch (ParseException e) { if (this.properties.isVerbose()) { this.logger.error("Failed to parse date", e); } } } if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_REVISION)) { documentLocaleParameters.put(WikiDocumentFilter.PARAMETER_LASTREVISION, pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_REVISION)); } // > WikiDocumentLocale proxyFilter.beginWikiDocumentLocale(locale, documentLocaleParameters); // Revisions if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_REVISIONS)) { List<Long> revisions = this.confluencePackage.getLongList(pageProperties, ConfluenceXMLPackage.KEY_PAGE_REVISIONS); for (Long revisionId : revisions) { readPageRevision(revisionId, filter, proxyFilter); } } // Current version readPageRevision(pageId, filter, proxyFilter); // < WikiDocumentLocale proxyFilter.endWikiDocumentLocale(locale, documentLocaleParameters); // < WikiDocument proxyFilter.endWikiDocument(documentName, documentParameters); }
From source file:org.xwiki.contrib.confluence.filter.internal.input.ConfluenceInputFilterStream.java
private void readPageRevision(long pageId, PropertiesConfiguration pageProperties, Object filter, ConfluenceFilter proxyFilter) throws FilterException { String revision = pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_REVISION); FilterEventParameters documentRevisionParameters = new FilterEventParameters(); if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_PARENT)) { try {//w ww . jav a 2 s . c o m documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_PARENT, this.confluencePackage .getReferenceFromId(pageProperties, ConfluenceXMLPackage.KEY_PAGE_PARENT)); } catch (ConfigurationException e) { if (this.properties.isVerbose()) { this.logger.error("Failed to parse parent", e); } } } if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_REVISION_AUTHOR)) { documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_REVISION_AUTHOR, pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_REVISION_AUTHOR)); } if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_REVISION_DATE)) { try { documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_REVISION_DATE, this.confluencePackage .getDate(pageProperties, ConfluenceXMLPackage.KEY_PAGE_REVISION_DATE)); } catch (ParseException e) { if (this.properties.isVerbose()) { this.logger.error("Failed to parse date", e); } } } if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_REVISION_COMMENT)) { documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_REVISION_COMMENT, pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_REVISION_COMMENT)); } documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_TITLE, pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_TITLE)); String bodyContent = null; Syntax bodySyntax = null; int bodyType = -1; if (pageProperties.containsKey(ConfluenceXMLPackage.KEY_PAGE_BODY)) { bodyContent = pageProperties.getString(ConfluenceXMLPackage.KEY_PAGE_BODY); bodyType = pageProperties.getInt(ConfluenceXMLPackage.KEY_PAGE_BODY_TYPE, -1); switch (bodyType) { // Not bodyType means old Confluence syntax case -1: bodyType = 0; case 0: bodySyntax = ConfluenceParser.SYNTAX; break; case 2: bodySyntax = Syntax.CONFLUENCEXHTML_1_0; break; default: if (this.properties.isVerbose()) { this.logger.error("Unknown body type [{}]", bodyType); } break; } } // If target filter does not support rendering events, pass the content as it is if (!(filter instanceof Listener) && bodyContent != null && bodySyntax != null) { documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_CONTENT, bodyContent); documentRevisionParameters.put(WikiDocumentFilter.PARAMETER_SYNTAX, bodySyntax); } // > WikiDocumentRevision proxyFilter.beginWikiDocumentRevision(revision, documentRevisionParameters); // Content if (filter instanceof Listener && bodyContent != null && bodySyntax != null) { Listener listener = proxyFilter; if (this.properties.isConvertToXWiki()) { ConfluenceConverterListener converter = this.converterProvider.get(); converter.initialize(this.confluencePackage, this.properties, listener); listener = converter; } try { switch (bodyType) { case 0: this.confluenceWIKIParser.parse(new StringReader(bodyContent), listener); break; case 2: this.confluenceXHTMLParser.parse(new StringReader(bodyContent), listener); break; default: break; } } catch (org.xwiki.rendering.parser.ParseException e) { throw new FilterException(String.format("Failed parser content [%s]", bodyContent), e); } } // Attachments Map<String, PropertiesConfiguration> pageAttachments = new LinkedHashMap<>(); for (long attachmentId : this.confluencePackage.getAttachments(pageId)) { PropertiesConfiguration attachmentProperties; try { attachmentProperties = this.confluencePackage.getAttachmentProperties(pageId, attachmentId); } catch (ConfigurationException e) { throw new FilterException("Failed to get attachment properties", e); } String attachmentName = this.confluencePackage.getAttachmentName(attachmentProperties); PropertiesConfiguration currentAttachmentProperties = pageAttachments.get(attachmentName); if (currentAttachmentProperties != null) { long version = this.confluencePackage.getAttachementVersion(attachmentProperties); long currentVersion = this.confluencePackage.getAttachementVersion(currentAttachmentProperties); if (version > currentVersion) { pageAttachments.put(attachmentName, attachmentProperties); } } else { pageAttachments.put(attachmentName, attachmentProperties); } } for (PropertiesConfiguration attachmentProperties : pageAttachments.values()) { readAttachment(pageId, attachmentProperties, filter, proxyFilter); } // < WikiDocumentRevision proxyFilter.endWikiDocumentRevision(revision, documentRevisionParameters); }