TC-110123: Replace JAXB DatatypeConverter with JDK DatatypeFactory#5
Open
Shan-SmartBear wants to merge 3 commits into
Open
TC-110123: Replace JAXB DatatypeConverter with JDK DatatypeFactory#5Shan-SmartBear wants to merge 3 commits into
Shan-SmartBear wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
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 viaDatatypeFactory/XMLGregorianCalendar. - Replaced
DatatypeConverter.printDateTime(...)call sites in log parsing code withUtils.printDateTime(...). - Removed
javax.xml.bind.DatatypeConverterimports.
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.
66fc91c to
e5fc436
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.DatatypeConverterThe 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