[Fix] validate attribute values before parsing; fixes #37#74
Merged
Conversation
…ic instead of throwing raw exceptions; fixes #37
…ts guard and cover both branches The Uri.TryCreate guard was unreachable dead code on .NET 10 (file-path-derived candidates always parse as valid absolute URIs), so it could not be covered. Replace it with the meaningful, reachable File.Exists check and add a test for the existing-resource branch so the new code is fully covered.
Contributor
|
|
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.



Boolean and integer attribute parsing already route through the
ParseBoolean/ParseInt32diagnostic helpers (added with #35). This change closes the remaining gap for URI attribute values.Resource.GetEObjectno longer follows a cross-resource reference unguarded. It now verifies the referenced.ecorefile exists (File.Exists) before creating and loading it.Diagnosticis recorded inResource.Errorsand the reference is reported as unresolved (the typedGetEObject<T>then throws a clearInvalidOperationExceptionnaming the fragment) instead of a rawFileNotFoundException.DiagnosticsTestFixturecoverage for both a reference to a missing cross-resource.ecoreand a reference to an existing one, so both branches of the new guard are exercised.Note: an earlier revision also guarded the URI construction with
Uri.TryCreate, but on .NET 10 a candidate derived from a local file path always parses as a valid absolute URI, making that branch unreachable/untestable; it was removed in favour of the reachableFile.Existscheck.Full suite green (184 tests); new code fully covered locally (verified with coverlet).
Fixes #37.