From e128cbda075ae28dc7965455b3c047bc841228fc Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Sun, 23 Jan 2011 12:57:19 -0800 Subject: [PATCH] check syntax of description field in logtags files EventLog.java checks that the field descriptions are bracketed by parens, so we should to in order to avoid a runtime error from a logtag entry with bad syntax. Bug: 3381309 Change-Id: I1d4cbb190da6b81ec0b1f1de9b5bc3f3394d7ec1 --- tools/event_log_tags.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/event_log_tags.py b/tools/event_log_tags.py index 81e8b3964..645839ec2 100644 --- a/tools/event_log_tags.py +++ b/tools/event_log_tags.py @@ -90,6 +90,14 @@ class TagFile(object): else: description = None + if description: + # EventLog.java checks that the description field is + # surrounded by parens, so we should too (to avoid a runtime + # crash from badly-formatted descriptions). + if not re.match(r"\(.*\)\s*$", description): + self.AddError("tag \"%s\" has unparseable description" % (tagname,)) + continue + self.tags.append(Tag(tag, tagname, description, self.filename, self.linenum)) except (IOError, OSError), e: -- 2.11.0