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

Update task_manager.py #733

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RohanMishra315
Copy link

fixes: #722

  1. Check you have corrected Java version
  2. IsADirectoryError separately handeled.

fixes: konveyor#722
1. Check you have corrected Java version
2. IsADirectoryError separately handeled.

Signed-off-by: Rohan Mishra <[email protected]>
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 attempting a fix for this. Really appreciate it. A few suggestions...It would be better to fix this issue at the root instead of catching it as an exception. What is happening is that something that is not an error is being parsed as an OtherError with a wrong file path. The correct place to fix this would be in file https://github.com/konveyor/kai/blob/main/kai/reactive_codeplanner/task_runner/compiler/maven_validator.py

This is where we run the maven command and parse its output. To understand how we are parsing the errors, take a look at this function

def parse_error_line(
lines: list[str], index: int, match: re.Match[str]
) -> tuple[MavenCompilerError, int]:
"""
Parses an error line and returns a MavenCompilerError instance and the next index.
"""
acc = [lines[index]]
file_path = match.group(1).strip()
line_number = int(match.group(2)) if match.group(2) else -1
column_number = int(match.group(3)) if match.group(3) else -1
message = match.group(4).strip()
error_class = classify_error(message)
error = error_class(
file=file_path,
line=line_number,
column=column_number,
message=message,
details=[],
)
# Look ahead for details
details, next_index = extract_error_details(lines, index + 1)
error.details.extend(details)
# Extract additional information based on error type
extract_additional_info(error)
error.parse_lines = "\n".join(acc + details)
return error, next_index

Most probably the fix will be in this function (you may have to reproduce the issue to figure that out). To reproduce, you can simply create a new test in file https://github.com/konveyor/kai/blob/main/tests/test_maven_validator.py

Use the output in the issue description. Take a look at existing tests to figure out how the parse_error_lines function is called. And finally, reach out if you need help :)

Thank you again.

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.

Maven parsing error (see description for details)
2 participants