[jboss-jira] [JBoss JIRA] (LOGMGR-115) Writing the configuration file should handle properties with null values
James Perkins (JIRA)
issues at jboss.org
Fri Aug 18 14:07:00 EDT 2017
[ https://issues.jboss.org/browse/LOGMGR-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451546#comment-13451546 ]
James Perkins edited comment on LOGMGR-115 at 8/18/17 2:06 PM:
---------------------------------------------------------------
The other option would be to have the {{setPropertyValueString()}} not allow for {{null}} values. This would likely be the best option which would require {{removeProperty()}} is used.
Something like:
{code:java}
public void setPropertyValueString(final String propertyName, final String value) throws IllegalArgumentException {
if (isRemoved()) {
throw new IllegalArgumentException(String.format("Cannot set property \"%s\" on %s \"%s\" (removed)", propertyName, getDescription(), getName()));
}
if (propertyName == null) {
throw new IllegalArgumentException("propertyName is null");
}
if (value == null) {
throw new IllegalArgumentException(String.format("The value cannot be null for property %1$s, " +
"use removeProperty(\"%1$s\") to remove the property", propertyName));
}
setPropertyValueExpression(propertyName, ValueExpression.STRING_RESOLVER.resolve(value));
}
{code}
was (Author: jamezp):
The other option would be to have the {{setPropertyValueString()}} not allow for {{null}} values. This would likely be the best option which would require {{removeProperty()}} is used.
> Writing the configuration file should handle properties with null values
> ------------------------------------------------------------------------
>
> Key: LOGMGR-115
> URL: https://issues.jboss.org/browse/LOGMGR-115
> Project: JBoss Log Manager
> Issue Type: Enhancement
> Reporter: James Perkins
> Priority: Minor
>
> Currently in the configuration API if a property is set to {{null}} an NPE occurs during the write and is swallowed. The idea was the {{removeProperty()}} should be used in the API. We should though check for {{null}} values and either not write the value or leave the value blank and have the reader for the configuration assume a value of 0 length is {{null}}.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list