You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Gabor Andras (Jira)" <ji...@apache.org> on 2022/08/12 13:55:00 UTC

[jira] [Updated] (KAFKA-14165) ConfigTransformer.DEFAULT_PATTERN fails on Windows platform

     [ https://issues.apache.org/jira/browse/KAFKA-14165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabor Andras updated KAFKA-14165:
---------------------------------
    Description: 
When a configuration Map which has an entry with a key "someKey" and a value "${[file:/F:/properties.txt:fileKey|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 an unexpected 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.

  was:
 when a configuration Map which has an entry with a key "someKey" and a value "${file:/F:/properties.txt:fileKey}" is passed to the {{[transform(Map)|eclipse-javadoc:%E2%98%82=debezium-server-core/f:%5C/dev%5C/.m2%5C/repository%5C/org%5C/apache%5C/kafka%5C/kafka-clients%5C/3.2.1%5C/kafka-clients-3.2.1.jar=/maven.pomderived=/true=/=/maven.groupId=/org.apache.kafka=/=/maven.artifactId=/kafka-clients=/=/maven.version=/3.2.1=/=/maven.scope=/compile=/=/maven.pomderived=/true=/%3Corg.apache.kafka.common.config(ConfigTransformer.class%E2%98%83ConfigTransformer%E2%98%82%E2%98%82transform%E2%98%82Map]}} 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 an unexpected 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.


> ConfigTransformer.DEFAULT_PATTERN fails on Windows platform
> -----------------------------------------------------------
>
>                 Key: KAFKA-14165
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14165
>             Project: Kafka
>          Issue Type: Bug
>         Environment: Windows 10 OS
>            Reporter: Gabor Andras
>            Priority: Major
>
> When a configuration Map which has an entry with a key "someKey" and a value "${[file:/F:/properties.txt:fileKey|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 an unexpected 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)