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

ConfigTransformer.DEFAULT_PATTERN fails on Windows platform

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • 3.2.1
    • None
    • config
    • None
    • Windows 10 OS

    Description

      When a configuration Map which has an entry with a key "someKey" and a value "${file:/F:/properties.txt:fileKey}" is passed to the ConfigTransformer.transform(Map) method, an exception is thrown:

      2022-08-12 16:44:21,553 ERROR [org.apa.kaf.com.con.pro.FileConfigProvider] (main) Could not read properties from file /F: java.nio.file.NoSuchFileException: \F
          at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
          at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
          at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
          at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
          at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
          at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
          at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
          at java.base/java.nio.file.Files.newInputStream(Files.java:160)
          at java.base/java.nio.file.Files.newBufferedReader(Files.java:2922)
          at java.base/java.nio.file.Files.newBufferedReader(Files.java:2955)
          at org.apache.kafka.common.config.provider.FileConfigProvider.reader(FileConfigProvider.java:104)
          at org.apache.kafka.common.config.provider.FileConfigProvider.get(FileConfigProvider.java:86)
          at org.apache.kafka.common.config.ConfigTransformer.transform(ConfigTransformer.java:103)

      This happens because of a colon ":" in the file name, which is wrongfully matched by the ConfigTransformer.DEFAULT_PATTERN in these three groups "file", "/F" and "/properties.txt:fileKey" instead of "file", "/F:/properties.txt" and "fileKey".

      The ConfigTransformer.DEFAULT_PATTERN should be changed to match the first and the last colon ":" in the expression.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggaborg Gabor Andras
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: