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

🐛 Not to fail when dependency SHA cannot be read from file. #272

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

Parthiba-Hazra
Copy link
Contributor

Hey in failure scenario I set d.ResolvedIdentifier as an empty string (d.ResolvedIdentifier = "").
Let me know if I need to set it to any other value.
I think this is the only function that need to update maybe have to update also parseMavenDepLines function .. let me know if I am wrong.

Issue: #175

@pranavgaikwad pranavgaikwad changed the title Not to fail when dependency SHA cannot be read from file. 🐛 Not to fail when dependency SHA cannot be read from file. Jul 27, 2023
Copy link
Contributor

@pranavgaikwad pranavgaikwad left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Requesting a small change

@@ -258,9 +258,14 @@ func (p *javaServiceClient) parseDepString(dep, localRepoPath string) (provider.
fp := filepath.Join(localRepoPath, strings.Replace(parts[0], ".", "/", -1), parts[1], d.Version, fmt.Sprintf("%v-%v.jar.sha1", parts[1], d.Version))
b, err := os.ReadFile(fp)
if err != nil {
return d, err
// Log the error and continue with the next dependency.
fmt.Printf("Error reading SHA hash file for dependency %s: %s\n", dep, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please change the fmt.Printf with logger instead? See example usage of the provider logger here

p.log.V(7).Info("Did not find open source dep list.")

That uses info function, we would use the Error() function of the logger instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sure ..

@@ -258,9 +258,14 @@ func (p *javaServiceClient) parseDepString(dep, localRepoPath string) (provider.
fp := filepath.Join(localRepoPath, strings.Replace(parts[0], ".", "/", -1), parts[1], d.Version, fmt.Sprintf("%v-%v.jar.sha1", parts[1], d.Version))
b, err := os.ReadFile(fp)
if err != nil {
return d, err
// Log the error and continue with the next dependency.
p.log.V(7).Info("Error reading SHA hash file for dependency %s: %s\n", dep, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
p.log.V(7).Info("Error reading SHA hash file for dependency %s: %s\n", dep, err)
p.log.V(5).Error(err, "error reading SHA hash file for dependency", "dep", d.Name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh my bad .. thanks for the suggestion. will update now

@pranavgaikwad pranavgaikwad merged commit 86939ec into konveyor:main Jul 27, 2023
7 checks passed
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