Skip to content

Compatibility with Java 17+ #14

@alanbarboza

Description

@alanbarboza

Description

I would like to request support for Java 17 compatibility for this library. Currently, the library uses DatatypeConverter.parseHexBinary, which is not available in Java 17. This method is often used for converting hexadecimal strings to byte arrays, which is a common requirement.

Steps to Reproduce

  1. Attempt to use DatatypeConverter.parseHexBinary in a Java 17 project.
  2. Observe that the method is not available and results in a compilation error.

Suggested Solution

To ensure compatibility with Java 17 and above, and to avoid unnecessary coupling with the jakarta.xml.bind library, I suggest removing this dependency from the project. Instead, consider using the HexFormat class available in Java 17 or providing a custom utility method for earlier versions.

byte[] keyBytes = DatatypeConverter.parseHexBinary(this.key);

Here is a proposed to change method that can be used for versions prior to Java 17:

byte[] keyBytes = HexFormat.of().parseHex(this.key);

Remove not necessary dependency at pom.xml file.

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions