Skip to content

Commit

Permalink
5368-Lenient-error-handler-doesn't-always-include-location-information (
Browse files Browse the repository at this point in the history
#6678)

* 5368---Lenient-error-handler-doesn't-always-include-location-information

* Credit for #6678

---------

Co-authored-by: James Agnew <[email protected]>
  • Loading branch information
elavy-harris and jamesagnew authored Feb 12, 2025
1 parent 1385edc commit 71aefee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public LenientErrorHandler(boolean theLogErrors) {
@Override
public void containedResourceWithNoId(IParseLocation theLocation) {
if (myLogErrors) {
ourLog.warn("Resource has contained child resource with no ID");
ourLog.warn("{}Resource has contained child resource with no ID", describeLocation(theLocation));
}
}

Expand All @@ -87,8 +87,9 @@ public void incorrectJsonType(
ScalarType theFoundScalarType) {
if (myLogErrors) {
if (ourLog.isWarnEnabled()) {
String message = createIncorrectJsonTypeMessage(
theElementName, theExpected, theExpectedScalarType, theFound, theFoundScalarType);
String message = describeLocation(theLocation) +
createIncorrectJsonTypeMessage(
theElementName, theExpected, theExpectedScalarType, theFound, theFoundScalarType);
ourLog.warn(message);
}
}
Expand Down Expand Up @@ -134,7 +135,7 @@ public boolean isErrorOnInvalidExtension() {
@Override
public void missingRequiredElement(IParseLocation theLocation, String theElementName) {
if (myLogErrors) {
ourLog.warn("Resource is missing required element: {}", theElementName);
ourLog.warn("{}Resource is missing required element: {}", describeLocation(theLocation), theElementName);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
type: add
issue: 5368
title: "Several error messages reported by the LenientErrorHandler (the default parser error handler)
did not include location information in their message. Thanks to Elliot Lavy for the contribution!"
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,11 @@
<name>Mangala Ekanayake</name>
<organization>Cambio</organization>
</developer>
<developer>
<id>elavy-harris</id>
<name>Eliott Lavy</name>
<organization>Harris</organization>
</developer>
</developers>

<licenses>
Expand Down

0 comments on commit 71aefee

Please sign in to comment.