Skip to content

Commit

Permalink
Merge pull request #2875 from sparklemotion/xalan-273_v1.14.x
Browse files Browse the repository at this point in the history
dep: update xalan to 2.7.3 (backport)
  • Loading branch information
flavorjones committed May 11, 2023
2 parents e8d2f4a + 3e91f5b commit de74596
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
9 changes: 8 additions & 1 deletion ext/java/nokogiri/XsltStylesheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.xml.transform.OutputKeys;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
Expand Down Expand Up @@ -184,9 +185,15 @@ public class XsltStylesheet extends RubyObject
XmlDocument xmlDoc = (XmlDocument) doc;
ByteArrayOutputStream writer = new ByteArrayOutputStream();

Serializer serializer = SerializerFactory.getSerializer(this.sheet.getOutputProperties());
java.util.Properties props = this.sheet.getOutputProperties();
if (props.getProperty(OutputKeys.METHOD) == null) {
props.setProperty(OutputKeys.METHOD, org.apache.xml.serializer.Method.UNKNOWN);
}

Serializer serializer = SerializerFactory.getSerializer(props);
serializer.setOutputStream(writer);
((SerializationHandler) serializer).serialize(xmlDoc.getNode());

return context.getRuntime().newString(writer.toString());
}

Expand Down
12 changes: 6 additions & 6 deletions lib/nokogiri/jruby/nokogiri_jars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
begin
require 'jar_dependencies'
rescue LoadError
require 'xalan/xalan/2.7.2/xalan-2.7.2.jar'
require 'xalan/serializer/2.7.3/serializer-2.7.3.jar'
require 'net/sourceforge/htmlunit/neko-htmlunit/2.63.0/neko-htmlunit-2.63.0.jar'
require 'nu/validator/jing/20200702VNU/jing-20200702VNU.jar'
require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
require 'org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar'
require 'net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar'
require 'xalan/xalan/2.7.3/xalan-2.7.3.jar'
require 'xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar'
require 'xalan/serializer/2.7.2/serializer-2.7.2.jar'
require 'isorelax/isorelax/20030108/isorelax-20030108.jar'
end

if defined? Jars
require_jar 'xalan', 'xalan', '2.7.2'
require_jar 'xalan', 'serializer', '2.7.3'
require_jar 'net.sourceforge.htmlunit', 'neko-htmlunit', '2.63.0'
require_jar 'nu.validator', 'jing', '20200702VNU'
require_jar 'xerces', 'xercesImpl', '2.12.2'
require_jar 'org.nokogiri', 'nekodtd', '0.1.11.noko1'
require_jar 'net.sf.saxon', 'Saxon-HE', '9.6.0-4'
require_jar 'xalan', 'xalan', '2.7.3'
require_jar 'xml-apis', 'xml-apis', '1.4.01'
require_jar 'xalan', 'serializer', '2.7.2'
require_jar 'isorelax', 'isorelax', '20030108'
end

Expand All @@ -33,8 +33,8 @@ module Nokogiri
"net.sourceforge.htmlunit:neko-htmlunit" => "2.63.0",
"nu.validator:jing" => "20200702VNU",
"org.nokogiri:nekodtd" => "0.1.11.noko1",
"xalan:serializer" => "2.7.2",
"xalan:xalan" => "2.7.2",
"xalan:serializer" => "2.7.3",
"xalan:xalan" => "2.7.3",
"xerces:xercesImpl" => "2.12.2",
"xml-apis:xml-apis" => "1.4.01",
}.freeze
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed lib/nokogiri/jruby/xalan/xalan/2.7.2/xalan-2.7.2.jar
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions nokogiri.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ Gem::Specification.new do |spec|
"lib/nokogiri/jruby/nokogiri_jars.rb",
"lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar",
"lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar",
"lib/nokogiri/jruby/xalan/serializer/2.7.2/serializer-2.7.2.jar",
"lib/nokogiri/jruby/xalan/xalan/2.7.2/xalan-2.7.2.jar",
"lib/nokogiri/jruby/xalan/serializer/2.7.3/serializer-2.7.3.jar",
"lib/nokogiri/jruby/xalan/xalan/2.7.3/xalan-2.7.3.jar",
"lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar",
"lib/nokogiri/jruby/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar",
"lib/nokogiri/syntax_error.rb",
Expand Down Expand Up @@ -330,8 +330,8 @@ Gem::Specification.new do |spec|
spec.requirements << "jar org.nokogiri, nekodtd, 0.1.11.noko1"
spec.requirements << "jar net.sourceforge.htmlunit, neko-htmlunit, 2.63.0"
spec.requirements << "jar nu.validator, jing, 20200702VNU" # https://search.maven.org/artifact/nu.validator/jing
spec.requirements << "jar xalan, serializer, 2.7.2" # https://search.maven.org/artifact/xalan/serializer
spec.requirements << "jar xalan, xalan, 2.7.2" # https://search.maven.org/artifact/xalan/xalan
spec.requirements << "jar xalan, serializer, 2.7.3" # https://search.maven.org/artifact/xalan/serializer
spec.requirements << "jar xalan, xalan, 2.7.3" # https://search.maven.org/artifact/xalan/xalan
spec.requirements << "jar xerces, xercesImpl, 2.12.2" # https://search.maven.org/artifact/xerces/xercesImpl
spec.requirements << "jar xml-apis, xml-apis, 1.4.01" # https://search.maven.org/artifact/xml-apis/xml-apis
else
Expand Down
6 changes: 5 additions & 1 deletion test/test_xslt_transforms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ def test_non_html_xslt_transform
# note that here the XPath 2.0 feature is `decimal`.
# this test case is taken from the example provided in the original issue.
#
# also: xalan 2.7.3 seems to understand the XPath 2.0 expression
#
skip_unless_libxml2("testing a crash that only happened with libxml2")

xml = <<~EOXML
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
Expand Down Expand Up @@ -356,7 +360,7 @@ def test_non_html_xslt_transform
)
else
assert_match(
/xmlXPathCompOpEval: function decimal not found|java.lang.NoSuchMethodException.*decimal/,
/xmlXPathCompOpEval: function decimal not found/,
exception.message,
)
end
Expand Down
3 changes: 1 addition & 2 deletions test/xslt/test_exception_handling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def test_java_exception_handling
xsl.transform(xml)
end

assert_match(/Can't have more than one root/, e.to_s,
"The exception message does not contain the expected information")
assert_includes(e.to_s, "HIERARCHY_REQUEST_ERR")
end
end
end
Expand Down

0 comments on commit de74596

Please sign in to comment.