nokogiri 1.10.1-java → 1.10.2-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e494bcd53ca9b668b441e9ac7004710eab1157144414a9cf17a225ae7331cd3c
4
- data.tar.gz: c321b8e32d8b6f3b3603a5176e45e568d1486bf93b503f59666d451b9a112231
3
+ metadata.gz: d3c43a257fb267d93e02093917d8d0299b56d781f6a26035fb0154ce26cc0197
4
+ data.tar.gz: 28b21e37d42567eb71f5d3ad893770dbe534357e082f5d23b130b506a3fc1a6f
5
5
  SHA512:
6
- metadata.gz: fec7dedb5e770c7698e078855bda287ce7a400207991dd04db185bf5f3d2f464962fa954f2c23784938bbc70ced8daa2aa7d44ccc47147a224d9fe45a47854a3
7
- data.tar.gz: 358510c46d46aa1f46388f153a873ff5d238c239e934b6fb24329fae865e7d466f260cfe567e9db063d6307f4f706a9539bdb122c9d670faeb3dab7ddf02a72a
6
+ metadata.gz: 9ae62018214d9b9362b94415bf2815cd1042263a960e590ed8a74cfbde6d451f628646f8e0ae45801d3e07ae36bdcfa8760c90f58968a15045893b47900cc549
7
+ data.tar.gz: 2079dcc1014d64f273674391708181d70fa90b15cbeceac970b37d685ebab21a61c43b555cba83627aa882472051e40470c7b1ee330086888acb4a4b6e882643
data/README.md CHANGED
@@ -9,17 +9,22 @@ or CSS3 selectors.
9
9
 
10
10
  ## Links
11
11
 
12
- * http://nokogiri.org
13
- * [Installation Help](http://nokogiri.org/tutorials/installing_nokogiri.html)
14
- * [Tutorials](http://nokogiri.org)
12
+ * https://nokogiri.org
13
+ * [Installation Help](https://nokogiri.org/tutorials/installing_nokogiri.html)
14
+ * [Tutorials](https://nokogiri.org)
15
15
  * [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
16
16
  * [GitHub](https://github.com/sparklemotion/nokogiri)
17
17
  * [Mailing List](https://groups.google.com/group/nokogiri-talk)
18
18
  * [Chat/Gitter](https://gitter.im/sparklemotion/nokogiri)
19
19
 
20
- [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/ruby-2.4-system/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri?groups=master)
21
20
 
21
+ ## Status
22
+
23
+ [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/ruby-2.4-system/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri)
24
+ [![Appveyor CI](https://ci.appveyor.com/api/projects/status/xj2pqwvlxwuwgr06/branch/master?svg=true)](https://ci.appveyor.com/project/flavorjones/nokogiri/branch/master)
22
25
  [![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
26
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/59c67b0e8976027a45ad/test_coverage)](https://codeclimate.com/github/sparklemotion/nokogiri/test_coverage)
27
+
23
28
  [![Gem Version](https://badge.fury.io/rb/nokogiri.svg)](https://rubygems.org/gems/nokogiri)
24
29
  [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)
25
30
  [![Tidelift dependencies](https://tidelift.com/badges/github/sparklemotion/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
@@ -50,13 +55,13 @@ gem install nokogiri
50
55
 
51
56
  then please start troubleshooting here:
52
57
 
53
- > http://www.nokogiri.org/tutorials/installing_nokogiri.html
58
+ > https://nokogiri.org/tutorials/installing_nokogiri.html
54
59
 
55
60
  There are currently 1,237 Stack Overflow questions about Nokogiri
56
61
  installation. The vast majority of them are out of date and therefore
57
62
  incorrect. __Please do not use Stack Overflow.__
58
63
 
59
- Instead, [tell us](http://nokogiri.org/tutorials/getting_help.html)
64
+ Instead, [tell us](https://nokogiri.org/tutorials/getting_help.html)
60
65
  when the above instructions don't work for you. This allows us to both
61
66
  help you directly and improve the documentation.
62
67
 
@@ -72,12 +77,13 @@ Binary packages are available for some distributions.
72
77
 
73
78
  ## Support
74
79
 
75
- There are open-source tutorials (to which we invite contributions!) here: http://nokogiri.org/tutorials
80
+ All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
76
81
 
77
82
  * The Nokogiri mailing list is active: https://groups.google.com/group/nokogiri-talk
78
83
  * The Nokogiri bug tracker is here: https://github.com/sparklemotion/nokogiri/issues
79
84
  * Before filing a bug report, please read our submission guidelines: http://nokogiri.org/tutorials/getting_help.html
80
- * The IRC channel is #nokogiri on freenode.
85
+ * The IRC channel is `#nokogiri` on freenode.
86
+ * The project's GitHub wiki has an excellent community-maintained [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet) which might be useful.
81
87
 
82
88
  Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Nokogiri. [Tidelift][tidelift] subscriptions also help the Nokogiri maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
83
89
 
@@ -102,7 +108,7 @@ require 'nokogiri'
102
108
  require 'open-uri'
103
109
 
104
110
  # Fetch and parse HTML document
105
- doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))
111
+ doc = Nokogiri::HTML(open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
106
112
 
107
113
  puts "### Search for nodes by css"
108
114
  doc.css('nav ul.menu li a', 'article h2').each do |link|
@@ -136,7 +142,7 @@ end
136
142
  * At install time, set the environment variable
137
143
  `NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
138
144
  `--use-system-libraries` argument. (See
139
- http://nokogiri.org/tutorials/installing_nokogiri.html#using_your_system_libraries
145
+ https://nokogiri.org/tutorials/installing_nokogiri.html#install-with-system-libraries
140
146
  for specifics.)
141
147
 
142
148
  * libxml2 >=2.6.21 with iconv support
@@ -176,7 +182,7 @@ explicitly setting the encoding to EUC-JP on the parser:
176
182
 
177
183
  ```bash
178
184
  bundle install
179
- bundle exec rake
185
+ bundle exec rake compile test
180
186
  ```
181
187
 
182
188
 
@@ -32,13 +32,12 @@
32
32
 
33
33
  package nokogiri;
34
34
 
35
- import nokogiri.internals.HtmlDomParserContext;
36
35
  import org.jruby.Ruby;
37
36
  import org.jruby.RubyClass;
38
37
  import org.jruby.anno.JRubyClass;
39
38
  import org.jruby.anno.JRubyMethod;
40
- import org.jruby.javasupport.util.RuntimeHelpers;
41
39
  import org.jruby.runtime.Arity;
40
+ import org.jruby.runtime.Helpers;
42
41
  import org.jruby.runtime.ThreadContext;
43
42
  import org.jruby.runtime.builtin.IRubyObject;
44
43
  import org.w3c.dom.Attr;
@@ -47,6 +46,8 @@ import org.w3c.dom.NamedNodeMap;
47
46
  import org.w3c.dom.Node;
48
47
  import org.w3c.dom.NodeList;
49
48
 
49
+ import nokogiri.internals.HtmlDomParserContext;
50
+
50
51
  /**
51
52
  * Class for Nokogiri::HTML::Document.
52
53
  *
@@ -81,7 +82,7 @@ public class HtmlDocument extends XmlDocument {
81
82
  throw context.getRuntime().newRuntimeError("couldn't create document: " + ex);
82
83
  }
83
84
 
84
- RuntimeHelpers.invoke(context, htmlDocument, "initialize", args);
85
+ Helpers.invoke(context, htmlDocument, "initialize", args);
85
86
 
86
87
  return htmlDocument;
87
88
  }
@@ -32,7 +32,7 @@
32
32
 
33
33
  package nokogiri;
34
34
 
35
- import static org.jruby.javasupport.util.RuntimeHelpers.invoke;
35
+ import static org.jruby.runtime.Helpers.invoke;
36
36
 
37
37
  import org.cyberneko.html.HTMLEntities;
38
38
  import org.jruby.Ruby;
@@ -34,7 +34,7 @@ package nokogiri;
34
34
 
35
35
  import static nokogiri.XmlSaxPushParser.terminateExecution;
36
36
  import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
37
- import static org.jruby.javasupport.util.RuntimeHelpers.invoke;
37
+ import static org.jruby.runtime.Helpers.invoke;
38
38
 
39
39
  import java.io.ByteArrayInputStream;
40
40
  import java.io.InputStream;
@@ -45,14 +45,6 @@ import java.util.List;
45
45
  import javax.xml.parsers.DocumentBuilderFactory;
46
46
  import javax.xml.parsers.ParserConfigurationException;
47
47
 
48
- import nokogiri.internals.NokogiriHelpers;
49
- import nokogiri.internals.NokogiriNamespaceCache;
50
- import nokogiri.internals.SaveContextVisitor;
51
- import nokogiri.internals.XmlDomParserContext;
52
- import nokogiri.internals.c14n.CanonicalFilter;
53
- import nokogiri.internals.c14n.CanonicalizationException;
54
- import nokogiri.internals.c14n.Canonicalizer;
55
-
56
48
  import org.jruby.Ruby;
57
49
  import org.jruby.RubyArray;
58
50
  import org.jruby.RubyClass;
@@ -61,9 +53,9 @@ import org.jruby.RubyNil;
61
53
  import org.jruby.anno.JRubyClass;
62
54
  import org.jruby.anno.JRubyMethod;
63
55
  import org.jruby.javasupport.JavaUtil;
64
- import org.jruby.javasupport.util.RuntimeHelpers;
65
56
  import org.jruby.runtime.Arity;
66
57
  import org.jruby.runtime.Block;
58
+ import org.jruby.runtime.Helpers;
67
59
  import org.jruby.runtime.ThreadContext;
68
60
  import org.jruby.runtime.builtin.IRubyObject;
69
61
  import org.w3c.dom.Attr;
@@ -73,6 +65,14 @@ import org.w3c.dom.NamedNodeMap;
73
65
  import org.w3c.dom.Node;
74
66
  import org.w3c.dom.NodeList;
75
67
 
68
+ import nokogiri.internals.NokogiriHelpers;
69
+ import nokogiri.internals.NokogiriNamespaceCache;
70
+ import nokogiri.internals.SaveContextVisitor;
71
+ import nokogiri.internals.XmlDomParserContext;
72
+ import nokogiri.internals.c14n.CanonicalFilter;
73
+ import nokogiri.internals.c14n.CanonicalizationException;
74
+ import nokogiri.internals.c14n.Canonicalizer;
75
+
76
76
  /**
77
77
  * Class for Nokogiri::XML::Document
78
78
  *
@@ -264,7 +264,7 @@ public class XmlDocument extends XmlNode {
264
264
  throw context.getRuntime().newRuntimeError("couldn't create document: "+ex.toString());
265
265
  }
266
266
 
267
- RuntimeHelpers.invoke(context, xmlDocument, "initialize", args);
267
+ Helpers.invoke(context, xmlDocument, "initialize", args);
268
268
 
269
269
  return xmlDocument;
270
270
  }
@@ -397,6 +397,20 @@ public class XmlDocument extends XmlNode {
397
397
  return getCachedNodeOrCreate(context.getRuntime(), rootNode);
398
398
  }
399
399
 
400
+ protected IRubyObject dup_implementation(Ruby runtime, boolean deep) {
401
+ XmlDocument doc = (XmlDocument) super.dup_implementation(runtime, deep);
402
+ // Avoid creating a new XmlDocument since we cloned one
403
+ // already. Otherwise the following test will fail:
404
+ //
405
+ // dup = doc.dup
406
+ // dup.equal?(dup.children[0].document)
407
+ //
408
+ // Since `dup.children[0].document' will end up creating a new
409
+ // XmlDocument. See #1060.
410
+ doc.resetCache();
411
+ return doc;
412
+ }
413
+
400
414
  @JRubyMethod(name="root=")
401
415
  public IRubyObject root_set(ThreadContext context, IRubyObject newRoot_) {
402
416
  // in case of document fragment, temporary root node should be deleted.
@@ -551,7 +565,7 @@ public class XmlDocument extends XmlNode {
551
565
  @JRubyMethod(meta=true)
552
566
  public static IRubyObject wrapJavaDocument(ThreadContext context, IRubyObject klazz, IRubyObject arg) {
553
567
  XmlDocument xmlDocument = (XmlDocument) NokogiriService.XML_DOCUMENT_ALLOCATOR.allocate(context.getRuntime(), getNokogiriClass(context.getRuntime(), "Nokogiri::XML::Document"));
554
- RuntimeHelpers.invoke(context, xmlDocument, "initialize");
568
+ Helpers.invoke(context, xmlDocument, "initialize");
555
569
  Document document = (Document)arg.toJava(Document.class);
556
570
  xmlDocument.setDocumentNode(context, document);
557
571
  return xmlDocument;
@@ -40,7 +40,6 @@ import static nokogiri.internals.NokogiriHelpers.rubyStringToString;
40
40
 
41
41
  import java.util.HashMap;
42
42
  import java.util.Map;
43
- import java.util.Set;
44
43
  import java.util.regex.Matcher;
45
44
  import java.util.regex.Pattern;
46
45
 
@@ -50,7 +49,7 @@ import org.jruby.RubyClass;
50
49
  import org.jruby.RubyString;
51
50
  import org.jruby.anno.JRubyClass;
52
51
  import org.jruby.anno.JRubyMethod;
53
- import org.jruby.javasupport.util.RuntimeHelpers;
52
+ import org.jruby.runtime.Helpers;
54
53
  import org.jruby.runtime.ThreadContext;
55
54
  import org.jruby.runtime.builtin.IRubyObject;
56
55
  import org.jruby.util.ByteList;
@@ -103,7 +102,7 @@ public class XmlDocumentFragment extends XmlNode {
103
102
  if (args.length == 3 && args[2] != null && args[2] instanceof XmlElement) {
104
103
  fragment.fragmentContext = (XmlElement)args[2];
105
104
  }
106
- RuntimeHelpers.invoke(context, fragment, "initialize", args);
105
+ Helpers.invoke(context, fragment, "initialize", args);
107
106
  return fragment;
108
107
  }
109
108
 
@@ -17,10 +17,10 @@
17
17
  * distribute, sublicense, and/or sell copies of the Software, and to
18
18
  * permit persons to whom the Software is furnished to do so, subject to
19
19
  * the following conditions:
20
- *
20
+ *
21
21
  * The above copyright notice and this permission notice shall be
22
22
  * included in all copies or substantial portions of the Software.
23
- *
23
+ *
24
24
  * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
25
25
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
26
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -64,7 +64,7 @@ import org.jruby.RubyString;
64
64
  import org.jruby.anno.JRubyClass;
65
65
  import org.jruby.anno.JRubyMethod;
66
66
  import org.jruby.exceptions.RaiseException;
67
- import org.jruby.javasupport.util.RuntimeHelpers;
67
+ import org.jruby.runtime.Helpers;
68
68
  import org.jruby.runtime.Block;
69
69
  import org.jruby.runtime.ThreadContext;
70
70
  import org.jruby.runtime.Visibility;
@@ -227,7 +227,7 @@ public class XmlNode extends RubyObject {
227
227
  doc = document(context.runtime);
228
228
 
229
229
  if (doc != null && ! doc.isNil()) {
230
- RuntimeHelpers.invoke(context, doc, "decorate", this);
230
+ Helpers.invoke(context, doc, "decorate", this);
231
231
  }
232
232
  }
233
233
  }
@@ -570,7 +570,7 @@ public class XmlNode extends RubyObject {
570
570
  static void setDocumentAndDecorate(ThreadContext context, RubyObject self, IRubyObject doc) {
571
571
  self.setInstanceVariable("@document", doc);
572
572
  if (doc != null) {
573
- RuntimeHelpers.invoke(context, doc, "decorate", self);
573
+ Helpers.invoke(context, doc, "decorate", self);
574
574
  }
575
575
  }
576
576
 
@@ -709,7 +709,7 @@ public class XmlNode extends RubyObject {
709
709
 
710
710
  @JRubyMethod(name = "blank?")
711
711
  public IRubyObject blank_p(ThreadContext context) {
712
- // according to libxml doc,
712
+ // according to libxml doc,
713
713
  // a node is blank if if it is a Text or CDATA node consisting of whitespace only
714
714
  if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.CDATA_SECTION_NODE) {
715
715
  String data = node.getTextContent();
@@ -853,7 +853,7 @@ public class XmlNode extends RubyObject {
853
853
  HtmlDomParserContext htmlCtx= (HtmlDomParserContext) ctx;
854
854
  htmlCtx.setEncoding(document.getEncoding().asJavaString());
855
855
  }
856
-
856
+
857
857
  XmlDocument doc = ctx.parse(context, klass, runtime.getNil());
858
858
 
859
859
  RubyArray documentErrors = getErrorArray(document);
@@ -1158,7 +1158,7 @@ public class XmlNode extends RubyObject {
1158
1158
  @JRubyMethod
1159
1159
  public IRubyObject namespace_definitions(ThreadContext context) {
1160
1160
  // don't use namespace_definitions cache anymore since
1161
- // namespaces might be deleted. Reflecting the result of
1161
+ // namespaces might be deleted. Reflecting the result of
1162
1162
  // namesapce removals is complicated, so the cache might not be
1163
1163
  // updated.
1164
1164
  Ruby ruby = context.getRuntime();
@@ -1279,7 +1279,7 @@ public class XmlNode extends RubyObject {
1279
1279
 
1280
1280
  String encString = encoding.isNil() ? null : rubyStringToString(encoding);
1281
1281
 
1282
- SaveContextVisitor visitor =
1282
+ SaveContextVisitor visitor =
1283
1283
  new SaveContextVisitor(RubyFixnum.fix2int(options), rubyStringToString(indentString), encString, isHtmlDoc(context), isFragment(), 0);
1284
1284
  accept(context, visitor);
1285
1285
 
@@ -1291,7 +1291,7 @@ public class XmlNode extends RubyObject {
1291
1291
  ByteList str = new ByteList(bytes.array(), bytes.arrayOffset(), bytes.remaining());
1292
1292
  rubyString = RubyString.newString(context.getRuntime(), str);
1293
1293
  }
1294
- RuntimeHelpers.invoke(context, io, "write", rubyString);
1294
+ Helpers.invoke(context, io, "write", rubyString);
1295
1295
 
1296
1296
  return io;
1297
1297
  }
@@ -1764,7 +1764,7 @@ public class XmlNode extends RubyObject {
1764
1764
  *
1765
1765
  * Loads and substitutes all xinclude elements below the node. The
1766
1766
  * parser context will be initialized with +options+.
1767
- *
1767
+ *
1768
1768
  */
1769
1769
  @JRubyMethod(visibility=Visibility.PRIVATE)
1770
1770
  public IRubyObject process_xincludes(ThreadContext context, IRubyObject options) {
@@ -33,19 +33,20 @@
33
33
  package nokogiri;
34
34
 
35
35
  import static nokogiri.internals.NokogiriHelpers.rubyStringToString;
36
- import nokogiri.internals.SaveContextVisitor;
37
36
 
38
37
  import org.jruby.Ruby;
39
38
  import org.jruby.RubyClass;
40
39
  import org.jruby.anno.JRubyClass;
41
40
  import org.jruby.anno.JRubyMethod;
42
- import org.jruby.javasupport.util.RuntimeHelpers;
41
+ import org.jruby.runtime.Helpers;
43
42
  import org.jruby.runtime.ThreadContext;
44
43
  import org.jruby.runtime.builtin.IRubyObject;
45
44
  import org.w3c.dom.Document;
46
45
  import org.w3c.dom.Node;
47
46
  import org.w3c.dom.ProcessingInstruction;
48
47
 
48
+ import nokogiri.internals.SaveContextVisitor;
49
+
49
50
  /**
50
51
  * Class for Nokogiri::XML::ProcessingInstruction
51
52
  *
@@ -81,7 +82,7 @@ public class XmlProcessingInstruction extends XmlNode {
81
82
  (RubyClass) klazz,
82
83
  node);
83
84
 
84
- RuntimeHelpers.invoke(context, self, "initialize", args);
85
+ Helpers.invoke(context, self, "initialize", args);
85
86
 
86
87
  // TODO: if_block_given.
87
88
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  package nokogiri;
34
34
 
35
- import static org.jruby.javasupport.util.RuntimeHelpers.invoke;
35
+ import static org.jruby.runtime.Helpers.invoke;
36
36
 
37
37
  import java.io.IOException;
38
38
  import java.io.InputStream;
@@ -33,7 +33,7 @@
33
33
  package nokogiri;
34
34
 
35
35
  import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
36
- import static org.jruby.javasupport.util.RuntimeHelpers.invoke;
36
+ import static org.jruby.runtime.Helpers.invoke;
37
37
 
38
38
  import java.io.ByteArrayInputStream;
39
39
  import java.io.IOException;
@@ -45,18 +45,20 @@ import java.util.concurrent.Future;
45
45
  import java.util.concurrent.FutureTask;
46
46
  import java.util.concurrent.ThreadFactory;
47
47
 
48
- import nokogiri.internals.*;
49
-
50
48
  import org.jruby.Ruby;
51
49
  import org.jruby.RubyClass;
52
- import org.jruby.RubyException;
53
50
  import org.jruby.RubyObject;
54
51
  import org.jruby.anno.JRubyClass;
55
52
  import org.jruby.anno.JRubyMethod;
56
53
  import org.jruby.exceptions.RaiseException;
57
54
  import org.jruby.runtime.ThreadContext;
58
55
  import org.jruby.runtime.builtin.IRubyObject;
59
- import org.xml.sax.SAXException;
56
+
57
+ import nokogiri.internals.ClosedStreamException;
58
+ import nokogiri.internals.NokogiriBlockingQueueInputStream;
59
+ import nokogiri.internals.NokogiriHandler;
60
+ import nokogiri.internals.NokogiriHelpers;
61
+ import nokogiri.internals.ParserContext;
60
62
 
61
63
  /**
62
64
  * Class for Nokogiri::XML::SAX::PushParser
@@ -40,9 +40,6 @@ import java.io.IOException;
40
40
  import java.io.PipedReader;
41
41
  import java.io.PipedWriter;
42
42
  import java.io.StringReader;
43
- import java.nio.CharBuffer;
44
- import java.util.HashMap;
45
- import java.util.Map;
46
43
  import java.util.Set;
47
44
  import java.util.regex.Matcher;
48
45
  import java.util.regex.Pattern;
@@ -57,8 +54,6 @@ import javax.xml.transform.dom.DOMSource;
57
54
  import javax.xml.transform.stream.StreamResult;
58
55
  import javax.xml.transform.stream.StreamSource;
59
56
 
60
- import nokogiri.internals.NokogiriXsltErrorListener;
61
-
62
57
  import org.apache.xalan.transformer.TransformerImpl;
63
58
  import org.apache.xml.serializer.SerializationHandler;
64
59
  import org.jruby.Ruby;
@@ -69,11 +64,13 @@ import org.jruby.RubyObject;
69
64
  import org.jruby.RubyString;
70
65
  import org.jruby.anno.JRubyClass;
71
66
  import org.jruby.anno.JRubyMethod;
72
- import org.jruby.javasupport.util.RuntimeHelpers;
67
+ import org.jruby.runtime.Helpers;
73
68
  import org.jruby.runtime.ThreadContext;
74
69
  import org.jruby.runtime.builtin.IRubyObject;
75
70
  import org.w3c.dom.Document;
76
71
 
72
+ import nokogiri.internals.NokogiriXsltErrorListener;
73
+
77
74
  /**
78
75
  * Class for Nokogiri::XSLT::Stylesheet
79
76
  *
@@ -327,14 +324,14 @@ public class XsltStylesheet extends RubyObject {
327
324
  if (htmlish) {
328
325
  args[3] = parse_options.getConstant("DEFAULT_HTML");
329
326
  RubyClass htmlDocumentClass = getNokogiriClass(runtime, "Nokogiri::HTML::Document");
330
- return RuntimeHelpers.invoke(context, htmlDocumentClass, "parse", args);
327
+ return Helpers.invoke(context, htmlDocumentClass, "parse", args);
331
328
  } else {
332
329
  args[3] = parse_options.getConstant("DEFAULT_XML");
333
330
  RubyClass xmlDocumentClass = getNokogiriClass(runtime, "Nokogiri::XML::Document");
334
- XmlDocument xmlDocument = (XmlDocument) RuntimeHelpers.invoke(context, xmlDocumentClass, "parse", args);
331
+ XmlDocument xmlDocument = (XmlDocument) Helpers.invoke(context, xmlDocumentClass, "parse", args);
335
332
  if (((Document)xmlDocument.getNode()).getDocumentElement() == null) {
336
333
  RubyArray errors = (RubyArray) xmlDocument.getInstanceVariable("@errors");
337
- RuntimeHelpers.invoke(context, errors, "<<", args[0]);
334
+ Helpers.invoke(context, errors, "<<", args[0]);
338
335
  }
339
336
  return xmlDocument;
340
337
  }
@@ -1,13 +1,11 @@
1
1
  package nokogiri.internals;
2
2
 
3
- import java.io.IOException;
4
3
  import java.io.InputStream;
5
4
 
6
5
  import org.jruby.Ruby;
7
6
  import org.jruby.RubyObject;
8
- import org.jruby.RubyProcess.Sys;
9
7
  import org.jruby.exceptions.RaiseException;
10
- import org.jruby.javasupport.util.RuntimeHelpers;
8
+ import org.jruby.runtime.Helpers;
11
9
  import org.jruby.runtime.ThreadContext;
12
10
  import org.jruby.runtime.builtin.IRubyObject;
13
11
  import org.jruby.util.ByteList;
@@ -41,7 +39,7 @@ public class NokogiriEncodingReaderWrapper extends InputStream {
41
39
  this.encodingReader = encodingReader;
42
40
  this.ruby = context.getRuntime();
43
41
 
44
- if (!RuntimeHelpers.invoke(context, encodingReader, "respond_to?", ruby.newSymbol("read")).isTrue()
42
+ if (!Helpers.invoke(context, encodingReader, "respond_to?", ruby.newSymbol("read")).isTrue()
45
43
  || encodingReader.getInstanceVariable("@io") == null) {
46
44
  throw ruby.newArgumentError("Argument doesn't respond to read or doesn't have instance variable @io");
47
45
  }
@@ -42,14 +42,11 @@ import java.util.HashSet;
42
42
  import java.util.LinkedList;
43
43
  import java.util.Set;
44
44
 
45
- import nokogiri.XmlSyntaxError;
46
-
47
45
  import org.jruby.Ruby;
48
46
  import org.jruby.RubyArray;
49
47
  import org.jruby.RubyClass;
50
- import org.jruby.RubyObject;
51
48
  import org.jruby.exceptions.RaiseException;
52
- import org.jruby.javasupport.util.RuntimeHelpers;
49
+ import org.jruby.runtime.Helpers;
53
50
  import org.jruby.runtime.ThreadContext;
54
51
  import org.jruby.runtime.builtin.IRubyObject;
55
52
  import org.xml.sax.Attributes;
@@ -58,6 +55,8 @@ import org.xml.sax.SAXException;
58
55
  import org.xml.sax.SAXParseException;
59
56
  import org.xml.sax.ext.DefaultHandler2;
60
57
 
58
+ import nokogiri.XmlSyntaxError;
59
+
61
60
  /**
62
61
  * A handler for SAX parsing.
63
62
  *
@@ -178,7 +177,7 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
178
177
  };
179
178
  }
180
179
 
181
- rubyAttr.append( RuntimeHelpers.invoke(context, attrClass, "new", args) );
180
+ rubyAttr.append( Helpers.invoke(context, attrClass, "new", args) );
182
181
  }
183
182
  }
184
183
 
@@ -246,27 +245,25 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
246
245
  charactersBuilder.setLength(0);
247
246
  }
248
247
 
249
- @Override
250
- public void error(SAXParseException ex) {
248
+ void handleError(SAXParseException ex) {
251
249
  try {
252
250
  final String msg = ex.getMessage();
253
251
  call("error", runtime.newString(msg == null ? "" : msg));
254
252
  addError(new RaiseException(XmlSyntaxError.createError(runtime, ex), true));
255
- } catch(RaiseException e) {
253
+ } catch( RaiseException e) {
256
254
  addError(e);
255
+ throw e;
257
256
  }
258
257
  }
259
258
 
260
259
  @Override
261
- public void fatalError(SAXParseException ex) {
262
- try {
263
- final String msg = ex.getMessage();
264
- call("error", runtime.newString(msg == null ? "" : msg));
265
- addError(new RaiseException(XmlSyntaxError.createFatalError(runtime, ex), true));
260
+ public void error(SAXParseException ex) {
261
+ handleError(ex);
262
+ }
266
263
 
267
- } catch(RaiseException e) {
268
- addError(e);
269
- }
264
+ @Override
265
+ public void fatalError(SAXParseException ex) {
266
+ handleError(ex);
270
267
  }
271
268
 
272
269
  @Override
@@ -289,22 +286,22 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
289
286
 
290
287
  private void call(String methodName) {
291
288
  ThreadContext context = runtime.getCurrentContext();
292
- RuntimeHelpers.invoke(context, document(context), methodName);
289
+ Helpers.invoke(context, document(context), methodName);
293
290
  }
294
291
 
295
292
  private void call(String methodName, IRubyObject argument) {
296
293
  ThreadContext context = runtime.getCurrentContext();
297
- RuntimeHelpers.invoke(context, document(context), methodName, argument);
294
+ Helpers.invoke(context, document(context), methodName, argument);
298
295
  }
299
296
 
300
297
  private void call(String methodName, IRubyObject arg1, IRubyObject arg2) {
301
298
  ThreadContext context = runtime.getCurrentContext();
302
- RuntimeHelpers.invoke(context, document(context), methodName, arg1, arg2);
299
+ Helpers.invoke(context, document(context), methodName, arg1, arg2);
303
300
  }
304
301
 
305
302
  private void call(String methodName, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
306
303
  ThreadContext context = runtime.getCurrentContext();
307
- RuntimeHelpers.invoke(context, document(context), methodName, arg1, arg2, arg3);
304
+ Helpers.invoke(context, document(context), methodName, arg1, arg2, arg3);
308
305
  }
309
306
 
310
307
  private void call(String methodName,
@@ -314,7 +311,7 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
314
311
  IRubyObject arg3,
315
312
  IRubyObject arg4) {
316
313
  ThreadContext context = runtime.getCurrentContext();
317
- RuntimeHelpers.invoke(context, document(context), methodName, arg0, arg1, arg2, arg3, arg4);
314
+ Helpers.invoke(context, document(context), methodName, arg0, arg1, arg2, arg3, arg4);
318
315
  }
319
316
 
320
317
  private IRubyObject document(ThreadContext context) {
@@ -45,7 +45,7 @@ import org.jruby.RubyFloat;
45
45
  import org.jruby.RubyInteger;
46
46
  import org.jruby.RubyString;
47
47
  import org.jruby.javasupport.JavaUtil;
48
- import org.jruby.javasupport.util.RuntimeHelpers;
48
+ import org.jruby.runtime.Helpers;
49
49
  import org.jruby.runtime.ThreadContext;
50
50
  import org.jruby.runtime.builtin.IRubyObject;
51
51
  import org.w3c.dom.NodeList;
@@ -83,7 +83,7 @@ public class NokogiriXPathFunction implements XPathFunction {
83
83
  final Ruby runtime = this.handler.getRuntime();
84
84
  ThreadContext context = runtime.getCurrentContext();
85
85
 
86
- IRubyObject result = RuntimeHelpers.invoke(context, this.handler, this.name, fromObjectToRubyArgs(runtime, args));
86
+ IRubyObject result = Helpers.invoke(context, this.handler, this.name, fromObjectToRubyArgs(runtime, args));
87
87
 
88
88
  return fromRubyToObject(runtime, result);
89
89
  }
Binary file
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.10.1'
3
+ VERSION = "1.10.2"
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -0,0 +1,40 @@
1
+ From 27e4aa8d885e47a296ea78d114dbbe8fc7aa3508 Mon Sep 17 00:00:00 2001
2
+ From: Kevin Solorio <soloriok@gmail.com>
3
+ Date: Fri, 1 Feb 2019 14:32:42 -0800
4
+ Subject: [PATCH] Revert-support-html-h-b-7-1
5
+
6
+ ---
7
+ entities.c | 17 -----------------
8
+ 1 file changed, 17 deletions(-)
9
+
10
+ diff --git a/entities.c b/entities.c
11
+ index 43549bc5..82652f6d 100644
12
+ --- a/entities.c
13
+ +++ b/entities.c
14
+ @@ -623,23 +623,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
15
+ *out++ = 't';
16
+ *out++ = ';';
17
+ } else if (*cur == '&') {
18
+ - /*
19
+ - * Special handling of &{...} construct from HTML 4, see
20
+ - * http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1
21
+ - */
22
+ - if (html && attr && (cur[1] == '{') &&
23
+ - (strchr((const char *) cur, '}'))) {
24
+ - while (*cur != '}') {
25
+ - *out++ = *cur++;
26
+ - indx = out - buffer;
27
+ - if (indx + 100 > buffer_size) {
28
+ - growBufferReentrant();
29
+ - out = &buffer[indx];
30
+ - }
31
+ - }
32
+ - *out++ = *cur++;
33
+ - continue;
34
+ - }
35
+ *out++ = '&';
36
+ *out++ = 'a';
37
+ *out++ = 'm';
38
+ --
39
+ 2.16.2
40
+
@@ -0,0 +1,44 @@
1
+ From ffc08467744bd2305d41ca882c37fa30adf3a067 Mon Sep 17 00:00:00 2001
2
+ From: Kevin Solorio <soloriok@gmail.com>
3
+ Date: Wed, 27 Feb 2019 14:34:17 -0800
4
+ Subject: [PATCH 2/2] update entities.c to remove handling of ssi
5
+
6
+ ---
7
+ entities.c | 21 ---------------------
8
+ 1 file changed, 21 deletions(-)
9
+
10
+ diff --git a/entities.c b/entities.c
11
+ index 43549bc5..5c4a2a60 100644
12
+ --- a/entities.c
13
+ +++ b/entities.c
14
+ @@ -592,27 +592,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
15
+ * By default one have to encode at least '<', '>', '"' and '&' !
16
+ */
17
+ if (*cur == '<') {
18
+ - const xmlChar *end;
19
+ -
20
+ - /*
21
+ - * Special handling of server side include in HTML attributes
22
+ - */
23
+ - if (html && attr &&
24
+ - (cur[1] == '!') && (cur[2] == '-') && (cur[3] == '-') &&
25
+ - ((end = xmlStrstr(cur, BAD_CAST "-->")) != NULL)) {
26
+ - while (cur != end) {
27
+ - *out++ = *cur++;
28
+ - indx = out - buffer;
29
+ - if (indx + 100 > buffer_size) {
30
+ - growBufferReentrant();
31
+ - out = &buffer[indx];
32
+ - }
33
+ - }
34
+ - *out++ = *cur++;
35
+ - *out++ = *cur++;
36
+ - *out++ = *cur++;
37
+ - continue;
38
+ - }
39
+ *out++ = '&';
40
+ *out++ = 'l';
41
+ *out++ = 't';
42
+ --
43
+ 2.16.2
44
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.10.2
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -14,14 +14,14 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-01-13 00:00:00.000000000 Z
17
+ date: 2019-03-25 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - "~>"
23
23
  - !ruby/object:Gem::Version
24
- version: '0.15'
24
+ version: '0.24'
25
25
  name: concourse
26
26
  prerelease: false
27
27
  type: :development
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.15'
32
+ version: '0.24'
33
33
  - !ruby/object:Gem::Dependency
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
@@ -509,6 +509,8 @@ files:
509
509
  - lib/xml-apis.jar
510
510
  - lib/xsd/xmlparser/nokogiri.rb
511
511
  - patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
512
+ - patches/libxml2/0002-Remove-script-macro-support.patch
513
+ - patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch
512
514
  homepage:
513
515
  licenses:
514
516
  - MIT