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

Solving AssertionFailedException TextFileChange.releaseDocument #2441

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IamLRBA
Copy link

@IamLRBA IamLRBA commented Oct 25, 2024

Explanation of Changes:

1. In the releaseDocument method

  • try-catch block: The change I made there helps manage any unexpected exceptions gracefully.

  • Condition checks: I added a check to ensure that the fBuffer and its associated document are not null, preventing actions on an invalid document.

  • Error message logging: Captures and logs messages if the document state is inconsistent, which can help trace issues without disrupting the cleanup operation.

2. Document State Checks on the acquireDocument method

Since releaseDocument might encounter a document in an inconsistent state, it’s also helpful to add checks to ensure that acquireDocument properly sets up the document and buffer. For instance, checking if the buffer has been fully connected and that the document isn’t null after connection will help prevent issues upon release. So that's why i added those checks.

3. Add Logging for Cancellation Scenarios in the isValid method

  • Cancellation Check: At the beginning of isValid, we have to check if monitor.isCanceled() returns true. If so, it should then log a message indicating that the operation was canceled, and return an error status to halt further processing.

  • Error Logging: Inside the catch block, an error message should be printed if a CoreException is encountered, giving more visibility into what caused the failure.

  • Validation Completion Log: At the end of a successful validation, it should log the result of needsSaving, which indicates whether the document needs saving. This can be useful for tracing the state of the document and knowing that validation completed without cancellation.

@IamLRBA
Copy link
Author

IamLRBA commented Oct 25, 2024

cc
@jukzi
Please have a look and check if I'm on the right track.
Thanks!

@jukzi jukzi linked an issue Oct 25, 2024 that may be closed by this pull request
Copy link
Contributor

@jukzi jukzi left a comment

Choose a reason for hiding this comment

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

formal notes: you are not supposed to add .gitigore misc.xml, vcs.sml.
You are supposed to add a link to the issue you are trying to solve into the commit message. #2340
I can not help with the issue itself. You should either write a junit test that shows the error/solution or describe how to manually test it.

@iloveeclipse
Copy link
Member

Also please remove all system out/err printouts, we have logging API.

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.

AssertionFailedException TextFileChange.releaseDocument
3 participants