Skip to content

Added code to the RegexColumnizer to avoid null columns & the resulting NullPointer exceptions#276

Merged
Hirogen merged 8 commits intoLogExperts:Developmentfrom
kniveg:RegexColumnizer-Avoid-Null-Columns
Mar 21, 2023
Merged

Added code to the RegexColumnizer to avoid null columns & the resulting NullPointer exceptions#276
Hirogen merged 8 commits intoLogExperts:Developmentfrom
kniveg:RegexColumnizer-Avoid-Null-Columns

Conversation

@kniveg
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
Collaborator

Hirogen commented Mar 20, 2023

Also please add respective Unit-Testcases :)

@kniveg
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 LogExperts: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