You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Gwen Shapira (JIRA)" <ji...@apache.org> on 2015/06/23 18:57:00 UTC

[jira] [Commented] (KAFKA-2297) VerifiableProperties fails when constructed with Properties with numeric values

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

Gwen Shapira commented on KAFKA-2297:
-------------------------------------

Yeah, I think its a known issue - VerifiableProperties only takes String values.

Considering that VerifiableProperties will be deprecated in next release in favor of AbstractConfig and ConfigDef, I'm not sure its worth fixing.
But if you already have a patch, feel free to submit :)

> VerifiableProperties fails when constructed with Properties with numeric values
> -------------------------------------------------------------------------------
>
>                 Key: KAFKA-2297
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2297
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 0.8.2.1
>         Environment: Ubuntu 12.04, OSX 10.9, OpenJDK 7, Scala 2.10
>            Reporter: Grant Overby
>            Priority: Minor
>
> VarifiableProperties produces java.lang.NumberFormatException: null when a get method for a numeric type is called and VerifiableProperties was constructed with a Properties containing a numeric type.
>     private static void works() {
>         Properties props = new Properties();
>         props.put("request.required.acks", "0");
>         new VerifiableProperties(props).getShort("request.required.acks", (short) 0);
>     }
>     private static void doesntWork() {
>         Properties props = new Properties();
>         props.put("request.required.acks", (short) 0);
>         new VerifiableProperties(props).getShort("request.required.acks", (short) 0);
>     }
> Exception in thread "main" java.lang.NumberFormatException: null
> 	at java.lang.Integer.parseInt(Integer.java:454)
> 	at java.lang.Short.parseShort(Short.java:117)
> 	at java.lang.Short.parseShort(Short.java:143)
> 	at scala.collection.immutable.StringLike$class.toShort(StringLike.scala:228)
> 	at scala.collection.immutable.StringOps.toShort(StringOps.scala:31)
> 	at kafka.utils.VerifiableProperties.getShortInRange(VerifiableProperties.scala:85)
> 	at kafka.utils.VerifiableProperties.getShort(VerifiableProperties.scala:61)
> 	at Main.doesntWork(Main.java:22)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)