-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added code to the RegexColumnizer to avoid null columns & the resulting NullPointer exceptions #276
Added code to the RegexColumnizer to avoid null columns & the resulting NullPointer exceptions #276
Conversation
…ty strings when the regex doesn't match the log line. Needed to avoid unexpected nullPointers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed please adapt
Also please add respective Unit-Testcases :) |
I made the requested changed. my apologies for the extra commits. I had some trouble getting the build to go green (C# is not the language I usually work in). |
|
||
var parsedLogLine = columnizer.SplitLine(Mock.Of<ILogLineColumnizerCallback>(), notMatchingLogLine); | ||
|
||
// verify that the expected number of columns are created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every Assert should be its own testcase, if those are just different data-sets, add the data to the function header (see the examples in "LogExpert.Tests" project :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for contributing 👍
I have added some code to the RegexColumnizer that will add columns with empty string when the line doesn't match the regex.
The reason I made this alteration is to fix the following problem I have been having: If you use this RegexColumnizer to read logs that contain stack traces (lines that don't match the regex) you get null columns for that line. This is visualized ok but will result in many error message pop-ups when searching in these columns making it hard to use this columnizer for these kind of logs.
The added code aims to fix this problem by eliminating the null columns. This doesn't change the visualisation but fixed the search problem.