Skip to content
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

Merged

Conversation

kniveg
Copy link

@kniveg kniveg commented Mar 8, 2023

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.

…ty strings when the regex doesn't match the log line. Needed to avoid unexpected nullPointers
@kniveg kniveg changed the title Added code to the RegexColumnizer avoid null columns & the resulting NullPointer exceptions Added code to the RegexColumnizer to avoid null columns & the resulting NullPointer exceptions Mar 8, 2023
Copy link
Collaborator

@Hirogen Hirogen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed please adapt

@Hirogen
Copy link
Collaborator

Hirogen commented Mar 20, 2023

Also please add respective Unit-Testcases :)

@kniveg
Copy link
Author

kniveg commented Mar 20, 2023

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).

@kniveg kniveg requested a review from Hirogen March 20, 2023 19:24

var parsedLogLine = columnizer.SplitLine(Mock.Of<ILogLineColumnizerCallback>(), notMatchingLogLine);

// verify that the expected number of columns are created
Copy link
Collaborator

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 :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for contributing 👍

@kniveg kniveg requested a review from Hirogen March 21, 2023 16:52
@Hirogen Hirogen merged commit 806f34f into zarunbal:Development Mar 21, 2023
@kniveg kniveg deleted the RegexColumnizer-Avoid-Null-Columns branch May 7, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants