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

license_finder falls over on com.sun.xml.ws:policy:2.7.10 ( "Undefined prefix Xlint found" ) #1043

Open
knoxg opened this issue Jul 11, 2024 · 0 comments

Comments

@knoxg
Copy link

knoxg commented Jul 11, 2024

( license_finder version 7.2.1 )

My maven project references com.sun.xml.ws:policy:2.7.10 , which breaks license_finder with the stack trace.

/usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb:403:in `block in pull_event': Undefined prefix Xlint found (REXML::UndefinedNamespaceException)
        from /usr/lib/ruby/3.0.0/set.rb:344:in `each_key'
        from /usr/lib/ruby/3.0.0/set.rb:344:in `each'
        from /usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb:401:in `pull_event'
        from /usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb:183:in `pull'
        from /usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb:23:in `parse'
        from /usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/document.rb:448:in `build'
        from /usr/lib/ruby/gems/3.0.0/gems/rexml-3.2.5/lib/rexml/document.rb:101:in `initialize'
        from /var/lib/gems/3.0.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:979:in `new'
        from /var/lib/gems/3.0.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:979:in `parse'
        from /var/lib/gems/3.0.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:164:in `xml_in'
        from /var/lib/gems/3.0.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:203:in `xml_in'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_utils/maven_dependency_finder.rb:45:in `add_info_from_pom'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_utils/maven_dependency_finder.rb:40:in `add_info_from_m2'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_utils/maven_dependency_finder.rb:21:in `block in dependencies'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_utils/maven_dependency_finder.rb:21:in `each'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_utils/maven_dependency_finder.rb:21:in `dependencies'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_managers/maven.rb:27:in `current_packages'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/package_manager.rb:105:in `current_packages_with_relations'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/scanner.rb:42:in `each'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/scanner.rb:42:in `flat_map'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/scanner.rb:42:in `active_packages'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/core.rb:84:in `current_packages'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/core.rb:79:in `decision_applier'
        from /usr/lib/ruby/3.0.0/forwardable.rb:232:in `acknowledged'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/license_aggregator.rb:51:in `block in aggregate_packages'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/license_aggregator.rb:49:in `each'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/license_aggregator.rb:49:in `flat_map'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/license_aggregator.rb:49:in `aggregate_packages'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/license_aggregator.rb:11:in `dependencies'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/lib/license_finder/cli/main.rb:161:in `report'
        from /var/lib/gems/3.0.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from /var/lib/gems/3.0.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /var/lib/gems/3.0.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from /var/lib/gems/3.0.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
        from /var/lib/gems/3.0.0/gems/license_finder-7.2.1/bin/license_finder:6:in `<top (required)>'
        from /usr/local/bin/license_finder:25:in `load'
        from /usr/local/bin/license_finder:25:in `<main>

It appears the XmlSimple parser is failing to parse this chunk of XML in the pom.xml file:

                    <compilerArguments>
                        <Xlint:all/>
                    </compilerArguments>

presumably because Xlint:all looks like an element with an XML namespace.

I worked around this by pre-processing the pom.xml file in my build script and removed the colon:

sed -i 's/Xlint:all/Xlint/g' /root/.m2/repository/com/sun/xml/ws/policy/2.7.10/policy-2.7.10.pom

but this is less than ideal.

Would be great if license_finder handled this pom.xml correctly.

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

No branches or pull requests

1 participant