Repository navigation
Do not crash diff when a source file is missing on the server - #5219
Open
mhammadtariq11 wants to merge 1 commit into
Open
mhammadtariq11 wants to merge 1 commit into
mhammadtariq11 wants to merge 1 commit into
Conversation
"CodeChecker cmd diff --resolved --output html" crashed with "'NoneType' object has no attribute 'encode'" when the source file of a report was not available on the server anymore. getSourceFileData() returns no content if the file is not in the database, e.g. it was removed by the garbage collection. The garbage collection removes files that are not referenced by any bug path data, so the file of a report whose bug path is entirely in other files can be removed. - Reports whose source file is not available on the server are skipped with a warning, since they cannot be converted. - If the content of a file is not available, a warning is logged and the local version of the file is used. Fixes Ericsson#3909
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CodeChecker cmd diff --resolved --output htmlcrashed with'NoneType' object has no attribute 'encode'when the source file of areport was not available on the server anymore.
Why
getSourceFileData()returns no content: the server returns anempty
SourceFileDataif the file id is not in the database. Files can beremoved by the database garbage collection (run at server start), which
deletes every file that is not referenced by any bug path data
(
report_path_data_files). The report's own file is not added thereexplicitly, so the file of a report whose bug path is entirely in other
files can be removed while the report still refers to it.
Changes in the client:
with a warning, since they cannot be converted (no file path, no source).
reports were queried), a warning is logged and the local version of the
file is used. The HTML output already handles files that cannot be read.
Fixes #3909
Testing:
missing, using the command from the issue
(
cmd diff --resolved --uniqueing on --output html). With the fix thecommand finishes, logs a warning and the other reports are written to
the HTML and table outputs.
convert_report_data_to_report(): content from theserver is used, missing content falls back to the local file, and a
report without a source file on the server is skipped. Two of them fail
with the error from the issue without this change.