Project

General

Profile

Actions

Bug #8844

closed

Nested ParseError in rexml

Added by ohai (Ippei Obayashi) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-08-31 trunk 42735) [x86_64-linux]
[ruby-dev:47672]

Description

以下のように不正なXMLをパースすると
require 'rexml/document'
REXML::Document.new("foo")
例外が発生し、以下のようなメッセージが表示されます(完全なものは添付したparseerror.txt)。
/home/ohai/.rbenv/versions/trunk-modified/lib/ruby/2.1.0/rexml/parsers/treeparser.rb:95:
in `rescue in parse': #<REXML::ParseException: Missing end tag for 'a' (got "b") (REXML:
:ParseException)
Line: 1
Position: 10
Last 80 unconsumed characters:

 :

nested_parseerror.rb:3:in `'
...
Missing end tag for 'a' (got "b")
Line: 1
Position: 10
Last 80 unconsumed characters:

Line: 1
Position: 10
Last 80 unconsumed characters:
:
同じ情報が何度も表示され、冗長です。

添付したパッチのように変更すればこの繰り返しはなくなるのですがどうでしょうか。


Files

parseerror.txt (1.29 KB) parseerror.txt ohai (Ippei Obayashi), 08/31/2013 01:29 PM
rexml-nested-parseerror.diff (1.01 KB) rexml-nested-parseerror.diff ohai (Ippei Obayashi), 08/31/2013 01:29 PM
Actions #1

Updated by kou (Kouhei Sutou) about 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42813.
Ippei, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/rexml/parsers/treeparser.rb (REXML::Parsers::TreeParser#parse):
    Remove needless nested parse exception information.
    [Bug #8844] [ruby-dev:47672]
    Reported by Ippei Obayashi. Thanks!!!
  • test/rexml/parser/test_tree.rb: Add a test for the above case.

Updated by kou (Kouhei Sutou) about 11 years ago

  • Assignee set to kou (Kouhei Sutou)

ありがとうございます!
取り込みました!

パッチには別の問題の修正もあったのでそっちも取り込みました。

Actions

Also available in: Atom PDF

Like0
Like0Like0