Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#12659 closed defect (fixed)

SpamFilter ParseError: no element found: line 1, column 0

Reported by: Christian Boos Owned by: Christian Boos
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a GET operation on /admin/spamfilter/monitor, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'cat_id': u'spamfilter', 'panel_id': u'monitor', 'path_info': None}

User agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

System Information

Trac 1.3.2.dev0
Babel 2.3.4
Docutils 0.11
Genshi 0.7 (with speedups)
GIT 1.9.1
Jinja2 2.9.3
Pillow 2.3.0
Pygments 2.1.3
pysqlite 2.6.0
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4]
pytz 2016.6.1
setuptools 25.2.0
SQLite 3.8.2
Subversion 1.8.8 (r1568071)
jQuery 1.11.3
jQuery UI 1.11.4
jQuery Timepicker 1.5.5

Enabled Plugins

MilestoneOperation N/A
new-ticket-in-milestone r6326
TracSpamFilter 1.3.0.dev0
vulnerability-tickets N/A

Interface Customization

shared-htdocs
shared-templates
site-htdocs Henri.png, LinLibertineWOFF-5.3.0, Thumbs.db, style.css, style.css~
site-templates --list_of_attachments.html, site.html, site_head.html

Python Traceback

Traceback (most recent call last):
  File "/mnt/d/Trac/repos/trunk/trac/web/main.py", line 630, in _dispatch_request
    dispatcher.dispatch(req)
  File "/mnt/d/Trac/repos/trunk/trac/web/main.py", line 252, in dispatch
    resp = chosen_handler.process_request(req)
  File "/mnt/d/Trac/repos/trunk/trac/admin/web_ui.py", line 96, in process_request
    resp = provider.render_admin_panel(req, cat_id, panel_id, path_info)
  File "/mnt/d/Trac/plugins/spam-filter-trunk/tracspamfilter/admin.py", line 97, in render_admin_panel
    data = self._render_monitoring_panel(req, cat, page)
  File "/mnt/d/Trac/plugins/spam-filter-trunk/tracspamfilter/admin.py", line 229, in _render_monitoring_panel
    offset=offset))
  File "/mnt/d/Trac/plugins/spam-filter-trunk/tracspamfilter/model.py", line 260, in _doselect
    yield cls._from_db(env, row)
  File "/mnt/d/Trac/plugins/spam-filter-trunk/tracspamfilter/model.py", line 268, in _from_db
    fields[9] = cls._xml_to_reasons(fields[9])
  File "/mnt/d/Trac/plugins/spam-filter-trunk/tracspamfilter/model.py", line 297, in _xml_to_reasons
    root = ElementTree.fromstring(xml)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1301, in XML
    return parser.close()
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
ParseError: no element found: line 1, column 0

Attachments (1)

t12659-cope-with-empty-or-non-XML-reasons.diff (1.6 KB ) - added by Christian Boos 7 years ago.
more robust handling of spamfilter_log.reasons db content

Download all attachments as: .zip

Change History (6)

comment:1 by Christian Boos, 7 years ago

I realize I probably have garbage in the spamfilter_log table, but then, I didn't put it by hand and is probably there due to having used some intermediate version of SpamFilter.

Anyway, the fix I propose can't hurt, I think.

by Christian Boos, 7 years ago

more robust handling of spamfilter_log.reasons db content

comment:2 by Ryan J Ollos, 7 years ago

Looks like a good change. I'd just move the for r in list(root) block to an else clause since it can't raise the exception that's being trapped.

comment:3 by Ryan J Ollos, 7 years ago

Resolution: fixed
Status: newclosed

Committed to 1.2 branch in r15566, merged to trunk in r15567.

comment:4 by Ryan J Ollos, 7 years ago

Owner: changed from Dirk Stöcker to Christian Boos

comment:5 by anonymous, 6 years ago

Milestone: plugin - spam-filter

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.