Skip to content
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 Maven repo meta analysis failing with native image #241

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Jan 18, 2023

When running the repository meta analyzer as native images, it would fail to analyze Maven components with the following stacktrace:

java.util.MissingResourceException: Could not load any resource bundle by com.sun.org.apache.xml.internal.res.XMLErrorResources
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.lambda$getResourceBundle$5(SecuritySupport.java:280)
	at java.base@17.0.5/java.security.AccessController.executePrivileged(AccessController.java:168)
	at java.base@17.0.5/java.security.AccessController.doPrivileged(AccessController.java:318)
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.getResourceBundle(SecuritySupport.java:273)
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.getResourceBundle(SecuritySupport.java:262)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.res.XMLMessages.createXMLMessage(XMLMessages.java:84)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.utils.ObjectPool.getInstance(ObjectPool.java:144)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.utils.StringBufferPool.get(StringBufferPool.java:45)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.getStringValue(DOM2DTM.java:822)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.objects.XNodeSet.getStringFromNode(XNodeSet.java:219)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.objects.XNodeSet.str(XNodeSet.java:282)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.getResultAsType(XPathImplUtil.java:151)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:81)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:89)
	at org.acme.repositories.MavenMetaAnalyzer.analyze(MavenMetaAnalyzer.java:96)
	at org.acme.repositories.MavenMetaAnalyzer_ClientProxy.analyze(Unknown Source)

The necessary resource bundles are defined in quarkus-jaxb. Including quarkus-jaxb as dependency resolves the issue, and analysis is taking place as expected.

https://github.com/quarkusio/quarkus/blob/2.15.3.Final/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java#L38

When running the repository meta analyzer as native images, it would fail to analyze Maven components with the following stacktrace:

```
java.util.MissingResourceException: Could not load any resource bundle by com.sun.org.apache.xml.internal.res.XMLErrorResources
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.lambda$getResourceBundle$5(SecuritySupport.java:280)
	at java.base@17.0.5/java.security.AccessController.executePrivileged(AccessController.java:168)
	at java.base@17.0.5/java.security.AccessController.doPrivileged(AccessController.java:318)
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.getResourceBundle(SecuritySupport.java:273)
	at java.xml@17.0.5/jdk.xml.internal.SecuritySupport.getResourceBundle(SecuritySupport.java:262)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.res.XMLMessages.createXMLMessage(XMLMessages.java:84)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.utils.ObjectPool.getInstance(ObjectPool.java:144)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.utils.StringBufferPool.get(StringBufferPool.java:45)
	at java.xml@17.0.5/com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.getStringValue(DOM2DTM.java:822)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.objects.XNodeSet.getStringFromNode(XNodeSet.java:219)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.objects.XNodeSet.str(XNodeSet.java:282)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.getResultAsType(XPathImplUtil.java:151)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:81)
	at java.xml@17.0.5/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:89)
	at org.acme.repositories.MavenMetaAnalyzer.analyze(MavenMetaAnalyzer.java:96)
	at org.acme.repositories.MavenMetaAnalyzer_ClientProxy.analyze(Unknown Source)
```

The necessary resource bundles are defined in `quarkus-jaxb`. Including `quarkus-jaxb` as dependency resolves the issue, and analysis is taking place as expected.

https://github.com/quarkusio/quarkus/blob/2.15.3.Final/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java#L38
Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added defect Something isn't working domain/repo-meta-analysis labels Jan 18, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@kodiakhq kodiakhq bot merged commit ff2458f into main Jan 18, 2023
@kodiakhq kodiakhq bot deleted the fix-repo-meta-analyzer-native-image branch January 18, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants