Skip to content

[bug] [jruby] RelaxNG.read_memory does not work #2115

@flavorjones

Description

@flavorjones

Please describe the bug

While working on an unrelated issue with schema parsing, I noticed that there was no test coverage of XML::RelaxNG.read_memory and that running a simple test case causes an exception to be raised.

Help us reproduce what you're seeing

#! /usr/bin/env ruby

require 'nokogiri'

Nokogiri::XML::RelaxNG.read_memory(File.read("./test/files/address_book.rlx"))

results, using Nokogiri v1.10.10, in:

IOError: No message available
  read_memory at nokogiri/XmlSchema.java:161

Expected behavior

Running this in CRuby parses the schema successfully.

Environment

# Nokogiri (1.10.10)
    ---
    warnings: []
    nokogiri: 1.10.10
    ruby:
      version: 2.5.7
      platform: java
      description: jruby 9.2.9.0 (2.5.7) 2019-10-30 458ad3e OpenJDK 64-Bit Server VM 11.0.9.1+1-Ubuntu-0ubuntu1.20.04
        on 11.0.9.1+1-Ubuntu-0ubuntu1.20.04 [linux-x86_64]
      engine: jruby
      jruby: 9.2.9.0
    xerces: Xerces-J 2.12.0
    nekohtml: NekoHTML 1.9.21

Additional context

Digging in on the type of exception raise, it's a java.net.MalformedURLException being raised by factory.compileSchema(is); in XmlRelaxng.java for a StreamSource source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions