Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-2297

VerifiableProperties fails when constructed with Properties with numeric values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 0.8.2.1
    • None
    • clients
    • None
    • Ubuntu 12.04, OSX 10.9, OpenJDK 7, Scala 2.10

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            groverby Grant Overby
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: