Exception in .parse method reading file with incorrect encoding

RESOLVED FIXED

Status

Localization Infrastructure and Tools
compare-locales
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: flod, Assigned: Pike)

Tracking

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(2 attachments)

Created attachment 8808610 [details]
mailTurboMenu.properties

When running

entities, map = file_parser.parse()

On a file with wrong encoding, with 1.2 I get an exception, while 1.1 would simply log the error.

Traceback (most recent call last):
  File "/Users/flodolo/github/tmx_maker/tests/test_string_extraction.py", line 181, in testBrokenEnconding
    extraction.extractStrings()
  File "/Users/flodolo/github/tmx_maker/tmx_products/tmx_products.py", line 139, in extractStrings
    entities, map = file_parser.parse()
  File "/Users/flodolo/github/tmx_maker/libraries/compare-locales/compare_locales/parser.py", line 224, in parse
    for e in self:
  File "/Users/flodolo/github/tmx_maker/libraries/compare-locales/compare_locales/parser.py", line 237, in walk
    contents = ctx.contents
AttributeError: 'NoneType' object has no attribute 'contents'

Attached is the file generating this error.
(Assignee)

Comment 1

a year ago
This is a regression from bug 1290883.
Assignee: nobody → l10n
Blocks: 1290883
Comment hidden (mozreview-request)
Comment on attachment 8809037 [details]
bug 1315970, failed loading should return empty parse lits,

https://reviewboard.mozilla.org/r/91706/#review91594

Thanks, it makes sense and works as expected now.
Attachment #8809037 - Flags: review?(francesco.lodolo) → review+
(Assignee)

Comment 4

a year ago
https://hg.mozilla.org/l10n/compare-locales/rev/5735bcdca4f339e2aa08030774a18a3ae66dfcdc, marking FIXED.

Thanks for testing and the review.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
(Assignee)

Updated

a year ago
Blocks: 1315976
You need to log in before you can comment on or make changes to this bug.