-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix processing report files with Unicode in pathes. #58
Merged
Conversation
This file contains 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
I facing bellow exception in my environment and this commit help me to sovle it. My environment is: - Jenkins 2.190.3 - Java 11 - Jaxb plugin installed I also tried add -Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory to JAVA_OPT but it not work. 2019-11-28 08:46:10.593+0000 [id=51] WARNING j.t.i.j.MissingClassTelemetry#reportException: Added a missed class for missing class telemetry. Class: com.sun.xml.internal.bind.v2.ContextFactory java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory at jenkins.telemetry.impl.java11.CatcherClassLoader.findClass(CatcherClassLoader.java:47) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122) at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276) at javax.xml.bind.ContextFinder.find(ContextFinder.java:421) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) at hudson.plugins.sloccount.model.cloc.ClocReport.parse(ClocReport.java:65) at hudson.plugins.sloccount.model.SloccountParser.parse(SloccountParser.java:81) at hudson.plugins.sloccount.model.SloccountParser.invoke(SloccountParser.java:48) at hudson.plugins.sloccount.model.SloccountParser.invoke(SloccountParser.java:20) at hudson.FilePath.act(FilePath.java:1078) at hudson.FilePath.act(FilePath.java:1061) at hudson.plugins.sloccount.SloccountPublisher.perform(SloccountPublisher.java:87) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1074) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1840) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
Jenkins replaces some ASCII symbols like colons with Unicode storing builds data. Parsing reports letter when users open 'SLOCCount Results' window the plugin unable to retrieve SLOC information - file was stored by path with Unicode. It relates to JDK 8. Using unmarshal(File f) indeed proceses not the File but a URL based on its absolute path. When JDK tries to open connection it calles ParseUtil.decode(url.getFile()) against our path containing Unicode. This method converts Unicode back to ASCII. So we get java.io.FileNotFoundException wrapped in javax.xml.bind.JAXBException, which is ignored by the plugin. Using unmarshal(java.io.InputStream is) soleves the issue due to JDK uses passed InputStream and all described here above do not affect us.
Hi @ivaivalous, can you review the PR, please. |
basil
approved these changes
Jun 15, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Released in 1.26. |
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.
Jenkins replaces some ASCII symbols like colons with Unicode
storing builds data. Parsing reports letter when users open
'SLOCCount Results' window the plugin unable to retrieve
SLOC information - file was stored by path with Unicode.
It relates to JDK 8.
Using unmarshal(File f) indeed proceses not the File but a URL
based on its absolute path. When JDK tries to open connection it
calles ParseUtil.decode(url.getFile()) against our path containing
Unicode. This method converts Unicode back to ASCII. So we get
java.io.FileNotFoundException wrapped in javax.xml.bind.JAXBException,
which is ignored by the plugin. Using unmarshal(java.io.InputStream is)
soleves the issue due to JDK uses passed InputStream and all
described here above do not affect us.