This is an automated email from the ASF dual-hosted git repository. mattjuntunen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
The following commit(s) were added to refs/heads/master by this push: new 736fba93 javadoc and spotbug fixes 736fba93 is described below commit 736fba9313dbce5042ca5dda5e9f2236ce5c6e0c Author: Matt Juntunen <mattjuntu...@apache.org> AuthorDate: Sat Jun 18 22:57:10 2022 -0400 javadoc and spotbug fixes --- pom.xml | 3 ++ .../configuration2/CombinedConfiguration.java | 9 ++++-- .../interpol/ConfigurationInterpolator.java | 34 ++++++++++----------- .../configuration2/interpol/DefaultLookups.java | 35 +++++++++++----------- .../configuration2/tree/InMemoryNodeModel.java | 2 +- 5 files changed, 44 insertions(+), 39 deletions(-) diff --git a/pom.xml b/pom.xml index 5762d3ed..7fb102fe 100644 --- a/pom.xml +++ b/pom.xml @@ -782,6 +782,7 @@ <links> <link>https://docs.oracle.com/javase/8/docs/api/</link> <link>https://docs.spring.io/spring/docs/${spring.version}/javadoc-api/</link> + <link>https://commons.apache.org/proper/commons-text/javadocs/api-release/</link> </links> </configuration> </plugin> @@ -911,6 +912,7 @@ <links> <link>https://docs.oracle.com/javase/8/docs/api/</link> <link>https://docs.spring.io/spring/docs/${spring.version}/javadoc-api/</link> + <link>https://commons.apache.org/proper/commons-text/javadocs/api-release/</link> </links> <!-- Disable Doclint since the Javadoc in the generated code does not comply. --> <doclint>none</doclint> @@ -922,6 +924,7 @@ <links> <link>https://docs.oracle.com/javase/8/docs/api/</link> <link>https://docs.spring.io/spring/docs/${spring.version}/javadoc-api/</link> + <link>https://commons.apache.org/proper/commons-text/javadocs/api-release/</link> </links> </configuration> </plugin> diff --git a/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java b/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java index 1ae005fc..909680b4 100644 --- a/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java +++ b/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java @@ -653,14 +653,17 @@ public class CombinedConfiguration extends BaseHierarchicalConfiguration impleme return; } + boolean success = false; try { if (!isUpToDate()) { getSubConfigurationParentModel().replaceRoot(constructCombinedNode(), this); upToDate = true; } - } catch (final RuntimeException rex) { - endWrite(); - throw rex; + success = true; + } finally { + if (!success) { + endWrite(); + } } } diff --git a/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java b/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java index 25e7c9d3..ba74a452 100644 --- a/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java +++ b/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java @@ -206,59 +206,59 @@ public class ConfigurationInterpolator { * <th>Lookup</th> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_BASE64_DECODER}</td> + * <td>"base64Decoder"</td> * <td>{@link DefaultLookups#BASE64_DECODER BASE64_DECODER}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_BASE64_ENCODER}</td> + * <td>"base64Encoder"</td> * <td>{@link DefaultLookups#BASE64_ENCODER BASE64_ENCODER}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_CONST}</td> + * <td>"const"</td> * <td>{@link DefaultLookups#CONST CONST}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_DATE}</td> + * <td>"date"</td> * <td>{@link DefaultLookups#DATE DATE}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_ENV}</td> + * <td>"env"</td> * <td>{@link DefaultLookups#ENVIRONMENT ENVIRONMENT}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_FILE}</td> + * <td>"file"</td> * <td>{@link DefaultLookups#FILE FILE}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_JAVA}</td> + * <td>"java"</td> * <td>{@link DefaultLookups#JAVA JAVA}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_LOCALHOST}</td> + * <td>"localhost"</td> * <td>{@link DefaultLookups#LOCAL_HOST LOCAL_HOST}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_PROPERTIES}</td> + * <td>"properties"</td> * <td>{@link DefaultLookups#PROPERTIES PROPERTIES}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_RESOURCE_BUNDLE}</td> + * <td>"resourceBundle"</td> * <td>{@link DefaultLookups#RESOURCE_BUNDLE RESOURCE_BUNDLE}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_SYS}</td> + * <td>"sys"</td> * <td>{@link DefaultLookups#SYSTEM_PROPERTIES SYSTEM_PROPERTIES}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_URL_DECODER}</td> + * <td>"urlDecoder"</td> * <td>{@link DefaultLookups#URL_DECODER URL_DECODER}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_URL_ENCODER}</td> + * <td>"urlEncoder"</td> * <td>{@link DefaultLookups#URL_ENCODER URL_ENCODER}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_XML}</td> + * <td>"xml"</td> * <td>{@link DefaultLookups#XML XML}</td> * </tr> * </table> @@ -270,15 +270,15 @@ public class ConfigurationInterpolator { * <th>Lookup</th> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_DNS}</td> + * <td>"dns"</td> * <td>{@link DefaultLookups#DNS DNS}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_URL}</td> + * <td>"url"</td> * <td>{@link DefaultLookups#URL URL}</td> * </tr> * <tr> - * <td>{@value org.apache.commons.text.lookup.StringLookupFactory#KEY_SCRIPT}</td> + * <td>"script"</td> * <td>{@link DefaultLookups#SCRIPT SCRIPT}</td> * </tr> * </table> diff --git a/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java b/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java index 7ffa6ea9..e2ce1ae0 100644 --- a/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java +++ b/src/main/java/org/apache/commons/configuration2/interpol/DefaultLookups.java @@ -60,7 +60,7 @@ import org.apache.commons.text.lookup.StringLookupFactory; public enum DefaultLookups { /** - * The lookup for Base64 decoding, accessed using the prefix "{@value StringLookupFactory#KEY_BASE64_DECODER}". + * The lookup for Base64 decoding, accessed using the prefix {@code "base64Decoder"}. * * @see StringLookupFactory#base64DecoderStringLookup() * @since 2.4 @@ -68,7 +68,7 @@ public enum DefaultLookups { BASE64_DECODER(StringLookupFactory.KEY_BASE64_DECODER, new StringLookupAdapter(StringLookupFactory.INSTANCE.base64DecoderStringLookup())), /** - * The lookup for Base64 encoding, accessed using the prefix "{@value StringLookupFactory#KEY_BASE64_ENCODER}". + * The lookup for Base64 encoding, accessed using the prefix {@code "base64Encoder"}. * * @see StringLookupFactory#base64EncoderStringLookup() * @since 2.4 @@ -76,7 +76,7 @@ public enum DefaultLookups { BASE64_ENCODER(StringLookupFactory.KEY_BASE64_ENCODER, new StringLookupAdapter(StringLookupFactory.INSTANCE.base64EncoderStringLookup())), /** - * The lookup for Java constants, accessed using the prefix "{@value StringLookupFactory#KEY_CONST}". + * The lookup for Java constants, accessed using the prefix {@code "const"}. * * @see StringLookupFactory#constantStringLookup() * @since 2.4 @@ -84,8 +84,7 @@ public enum DefaultLookups { CONST(StringLookupFactory.KEY_CONST, new StringLookupAdapter(StringLookupFactory.INSTANCE.constantStringLookup())), /** - * The lookup for the current date in a specified format, accessed using the prefix - * "{@value StringLookupFactory#KEY_DATE}". + * The lookup for the current date in a specified format, accessed using the prefix {@code "date"}. * * @see StringLookupFactory#dateStringLookup() * @since 2.4 @@ -93,7 +92,7 @@ public enum DefaultLookups { DATE(StringLookupFactory.KEY_DATE, new StringLookupAdapter(StringLookupFactory.INSTANCE.dateStringLookup())), /** - * The lookup for DNS, accessed using the prefix "{@value StringLookupFactory#KEY_DNS}". + * The lookup for DNS, accessed using the prefix {@code "dns"}. * * @see StringLookupFactory#dnsStringLookup() * @since 2.6 @@ -101,14 +100,14 @@ public enum DefaultLookups { DNS(StringLookupFactory.KEY_DNS, new StringLookupAdapter(StringLookupFactory.INSTANCE.dnsStringLookup())), /** - * The lookup for environment properties, accessed using the prefix "{@value StringLookupFactory#KEY_ENV}". + * The lookup for environment properties, accessed using the prefix {@code "env"}. * * @see StringLookupFactory#environmentVariableStringLookup() */ ENVIRONMENT(StringLookupFactory.KEY_ENV, new StringLookupAdapter(StringLookupFactory.INSTANCE.environmentVariableStringLookup())), /** - * The lookup for file content, accessed using the prefix "{@value StringLookupFactory#KEY_FILE}". + * The lookup for file content, accessed using the prefix {@code "file"}. * * @see StringLookupFactory#fileStringLookup() * @since 2.4 @@ -116,7 +115,7 @@ public enum DefaultLookups { FILE(StringLookupFactory.KEY_FILE, new StringLookupAdapter(StringLookupFactory.INSTANCE.fileStringLookup())), /** - * The lookup for Java platform information, accessed using the prefix "{@value StringLookupFactory#KEY_JAVA}". + * The lookup for Java platform information, accessed using the prefix {@code "java"}. * * @see StringLookupFactory#javaPlatformStringLookup() * @since 2.4 @@ -124,7 +123,7 @@ public enum DefaultLookups { JAVA(StringLookupFactory.KEY_JAVA, new StringLookupAdapter(StringLookupFactory.INSTANCE.javaPlatformStringLookup())), /** - * The lookup for localhost information, accessed using the prefix "{@value StringLookupFactory#KEY_LOCALHOST}". + * The lookup for localhost information, accessed using the prefix {@code "localhost"}. * * @see StringLookupFactory#localHostStringLookup() * @since 2.4 @@ -132,7 +131,7 @@ public enum DefaultLookups { LOCAL_HOST(StringLookupFactory.KEY_LOCALHOST, new StringLookupAdapter(StringLookupFactory.INSTANCE.localHostStringLookup())), /** - * The lookup for properties, accessed using the prefix "{@value StringLookupFactory#KEY_PROPERTIES}". + * The lookup for properties, accessed using the prefix {@code "properties"}. * * @see StringLookupFactory#propertiesStringLookup() * @since 2.4 @@ -140,7 +139,7 @@ public enum DefaultLookups { PROPERTIES(StringLookupFactory.KEY_PROPERTIES, new StringLookupAdapter(StringLookupFactory.INSTANCE.propertiesStringLookup())), /** - * The lookup for resource bundles, accessed using the prefix "{@value StringLookupFactory#KEY_RESOURCE_BUNDLE}". + * The lookup for resource bundles, accessed using the prefix {@code "resourceBundle"}. * * @see StringLookupFactory#resourceBundleStringLookup() * @since 2.4 @@ -148,7 +147,7 @@ public enum DefaultLookups { RESOURCE_BUNDLE(StringLookupFactory.KEY_RESOURCE_BUNDLE, new StringLookupAdapter(StringLookupFactory.INSTANCE.resourceBundleStringLookup())), /** - * The lookup for scripts, accessed using the prefix "{@value StringLookupFactory#KEY_SCRIPT}". + * The lookup for scripts, accessed using the prefix {@code "script"}. * * @see StringLookupFactory#scriptStringLookup() * @since 2.4 @@ -156,14 +155,14 @@ public enum DefaultLookups { SCRIPT(StringLookupFactory.KEY_SCRIPT, new StringLookupAdapter(StringLookupFactory.INSTANCE.scriptStringLookup())), /** - * The lookup for system properties, accessed using the prefix "{@value StringLookupFactory#KEY_SYS}". + * The lookup for system properties, accessed using the prefix {@code "sys"}. * * @see StringLookupFactory#systemPropertyStringLookup() */ SYSTEM_PROPERTIES(StringLookupFactory.KEY_SYS, new StringLookupAdapter(StringLookupFactory.INSTANCE.systemPropertyStringLookup())), /** - * The lookup for URLs, accessed using the prefix "{@value StringLookupFactory#KEY_URL}". + * The lookup for URLs, accessed using the prefix {@code "url"}. * * @see StringLookupFactory#urlStringLookup() * @since 2.4 @@ -171,7 +170,7 @@ public enum DefaultLookups { URL(StringLookupFactory.KEY_URL, new StringLookupAdapter(StringLookupFactory.INSTANCE.urlStringLookup())), /** - * The lookup for URL decoding, accessed using the prefix "{@value StringLookupFactory#KEY_URL_DECODER}". + * The lookup for URL decoding, accessed using the prefix {@code "urlDecoder"}. * * @see StringLookupFactory#urlDecoderStringLookup() * @since 2.4 @@ -179,7 +178,7 @@ public enum DefaultLookups { URL_DECODER(StringLookupFactory.KEY_URL_DECODER, new StringLookupAdapter(StringLookupFactory.INSTANCE.urlDecoderStringLookup())), /** - * The lookup for URL encoding, accessed using the prefix "{@value StringLookupFactory#KEY_URL_ENCODER}". + * The lookup for URL encoding, accessed using the prefix {@code "urlEncoder"}. * * @see StringLookupFactory#urlEncoderStringLookup() * @since 2.4 @@ -187,7 +186,7 @@ public enum DefaultLookups { URL_ENCODER(StringLookupFactory.KEY_URL_ENCODER, new StringLookupAdapter(StringLookupFactory.INSTANCE.urlEncoderStringLookup())), /** - * The lookup for XML content, accessed using the prefix "{@value StringLookupFactory#KEY_XML}". + * The lookup for XML content, accessed using the prefix {@code "xml"}. * * @see StringLookupFactory#xmlStringLookup() * @since 2.4 diff --git a/src/main/java/org/apache/commons/configuration2/tree/InMemoryNodeModel.java b/src/main/java/org/apache/commons/configuration2/tree/InMemoryNodeModel.java index 4cf40865..33ee670d 100644 --- a/src/main/java/org/apache/commons/configuration2/tree/InMemoryNodeModel.java +++ b/src/main/java/org/apache/commons/configuration2/tree/InMemoryNodeModel.java @@ -986,7 +986,7 @@ public class InMemoryNodeModel implements NodeModel<ImmutableNode> { * @param key the invalid key causing this exception * @return the exception */ - private static RuntimeException attributeKeyException(final String key) { + private static IllegalArgumentException attributeKeyException(final String key) { return new IllegalArgumentException("New nodes cannot be added to an attribute key: " + key); }