[ 
https://issues.apache.org/jira/browse/FLINK-13406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16909019#comment-16909019
 ] 

Till Rohrmann edited comment on FLINK-13406 at 8/16/19 12:33 PM:
-----------------------------------------------------------------

I think there would be a 3. option: Only store {{Strings}} in {{Properties}}. 
This effectively means to replace {{put}} calls with {{setProperty}}. That's 
also what the JavaDocs of {{Properties}} say. It is a bit unfortunate that 
{{Properties}} extends {{Hashtable}} because it obviously is not a 
{{Hashtable}}. Consequently, one could argue that we are misusing 
{{Properties}} and the {{MetricConfig}} by calling 
https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L661.


was (Author: till.rohrmann):
I think there would be a 3. option: Only store {{Strings}} in {{Properties}}. 
This effectively means to replace {{put}} calls with {{setProperty}}. That's 
also what the JavaDocs of {{Properties}} say. It is a bit unfortunate that 
{{Properties extends {{Hashtable}} because it obviously is not a {{Hashtable}}. 
Consequently, one could argue that we are misusing {{Properties}} and the 
{{MetricConfig}} by calling 
https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L661.

> MetricConfig.getInteger() always returns null
> ---------------------------------------------
>
>                 Key: FLINK-13406
>                 URL: https://issues.apache.org/jira/browse/FLINK-13406
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Metrics
>    Affects Versions: 1.6.3
>            Reporter: Ori Popowski
>            Priority: Minor
>
> {{MetricConfig}}'s {{getInteger}} will always return the default value.
> The reason is, since it delegates to Java's {{Properties.getProperty}} which 
> returns null if the type of the value is not {{String}}.
> h3. Reproduce
>  # Create a class {{MyReporter}} implementing {{MetricReporter}}
>  # Implment the {{open()}} method so that you do {{config.getInteger("foo", 
> null)}}
>  # Start an {{ExecutionEnvironment}} with and give it the following 
> Configuration object:
> {code:java}
> configuration.setString("metrics.reporters", "my");
> configuration.setClass("metrics.reporter.my.class", MyReporter.class)
> configuration.setInteger("metrics.reporter.my.foo", 42);{code}
>  # In {{open()}} the value of {{foo}} is null.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to