Guard against null-strings in lines
Without that patch, the tool chokes on lines with null-bytes in the middle, which as it turned out sometimes happens in neutron logs. Related-Bug: #1672921 Change-Id: I2ec2c637dc03008f4d964f88a788af0d69abe282
This commit is contained in:
parent
77c2819793
commit
733b98a8ec
|
@ -90,7 +90,7 @@ class LogEntry(object):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def prepare_line(self, line):
|
def prepare_line(self, line):
|
||||||
return line
|
return line.replace('\0', ' ')
|
||||||
|
|
||||||
def parse_date(self, line):
|
def parse_date(self, line):
|
||||||
try:
|
try:
|
||||||
|
@ -261,6 +261,7 @@ class MsgLogEntry(LogEntry):
|
||||||
# TODO: If year of file creation and file last modification are
|
# TODO: If year of file creation and file last modification are
|
||||||
# different we should start with the cration year and then change to
|
# different we should start with the cration year and then change to
|
||||||
# the next year once the months go back.
|
# the next year once the months go back.
|
||||||
|
line = super(MsgLogEntry, self).prepare_line(line)
|
||||||
return '%s%s' % (self.file_year, line)
|
return '%s%s' % (self.file_year, line)
|
||||||
|
|
||||||
def _calculate_date_length(self):
|
def _calculate_date_length(self):
|
||||||
|
|
Loading…
Reference in New Issue