Skip to content

TC-110123: Replace JAXB DatatypeConverter with JDK DatatypeFactory#5

Open
Shan-SmartBear wants to merge 3 commits into
masterfrom
bugfix/TC-110123-JAXB-DatatypeConverter
Open

TC-110123: Replace JAXB DatatypeConverter with JDK DatatypeFactory#5
Shan-SmartBear wants to merge 3 commits into
masterfrom
bugfix/TC-110123-JAXB-DatatypeConverter

Conversation

@Shan-SmartBear

Copy link
Copy Markdown

Problem
On Jenkins running Java 11 or newer (Java 17 / 21, Jenkins LTS 2.555+), the plugin fails with: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter

The test run finishes fine (exit code 0). The error happens later, when the plugin reads the TestComplete log and builds the JUnit-style report. Jenkins then marks the build as FAILED.

Cause
The plugin used javax.xml.bind.DatatypeConverter.printDateTime() to make the timestamp. JAXB (javax.xml.bind) was removed from the JDK in Java 11. Old Jenkins versions still had it by chance; from LTS 2.555 it is no longer on the plugin classpath.

Fix
Replaced the JAXB call with javax.xml.datatype.DatatypeFactory, which is part of the JDK (JAXP) and is present in Java 8, 11, 17 and 21.

Jira: https://smartbear.atlassian.net/browse/TC-110123

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the plugin’s timestamp formatting to avoid javax.xml.bind.DatatypeConverter, which is no longer present on Java 11+ classpaths, and replaces it with a JDK-available javax.xml.datatype.DatatypeFactory-based implementation so parsing TestComplete logs works on modern Jenkins/Java versions.

Changes:

  • Added Utils.printDateTime(Calendar) implemented via DatatypeFactory / XMLGregorianCalendar.
  • Replaced DatatypeConverter.printDateTime(...) call sites in log parsing code with Utils.printDateTime(...).
  • Removed javax.xml.bind.DatatypeConverter imports.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/smartbear/jenkins/plugins/testcomplete/Utils.java Introduces a JDK-compatible printDateTime(Calendar) helper using DatatypeFactory.
src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogParser.java Switches project timestamp generation to use the new Utils.printDateTime.
src/main/java/com/smartbear/jenkins/plugins/testcomplete/parser/LogNodeUtils.java Switches timestamp conversion helper to use Utils.printDateTime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/smartbear/jenkins/plugins/testcomplete/Utils.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/main/java/com/smartbear/jenkins/plugins/testcomplete/Utils.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/main/java/com/smartbear/jenkins/plugins/testcomplete/Utils.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants