Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

In unmarshaller, make errorLimitCounter customizable. #1154

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

Conversation

facundovs
Copy link

No description provided.

@facundovs facundovs changed the title MULE-13487: In unmarshaller, make errorLimitCounter customizable. In unmarshaller, make errorLimitCounter customizable. Nov 2, 2017
@aiannucci
Copy link

@bravehorsie or someone with access, any chance to review this? Fixes #1139
Thanks!

@lucalas
Copy link

lucalas commented Feb 8, 2018

@bravehorsie are there any news about it?

@taz77
Copy link

taz77 commented Feb 20, 2018

Took a lot of searching to find this, but this problem causes some of the code I work on to stop throwing errors when it should be. We test for proper errors being handled. Would be great if this PR could get reviewed and merged.

@matteobaccan
Copy link

Any news about this merge?

@taz77
Copy link

taz77 commented Aug 2, 2018

@bravehorsie I see you are a committer on this project. Can this PR get some attention? This continues to be a problem with JAXB that has not been resolved.

Copy link
Member

@bravehorsie bravehorsie left a comment

Choose a reason for hiding this comment

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

Besides comments in code please also fix copyright years in updated files and add copyright headers to files that were created.

After fixing comments above, the change looks good, thank you @facundovs !

If you want this PR to be accepted you need to sign http://www.oracle.com/technetwork/community/oca-486395.html

handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, Messages.ERRORS_LIMIT_EXCEEDED.format(),
getLocator().getLocation(), null), true);
}
return errorsCounter >= 0;
return false;
Copy link
Member

Choose a reason for hiding this comment

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

This won't work, if we always return false on shouldErrorBeReported(), error will never appear in the log.
Should be errorsCounter >= 0

return true;

if (errorsCounter >= 0) {
--errorsCounter;
if (errorsCounter == 0) // it's possible to miss this because of concurrency. If required add synchronization here
if (errorsCounter == -1) // it's possible to miss this because of concurrency. If required add synchronization here
Copy link
Member

Choose a reason for hiding this comment

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

Due to comment on concurrency should be errorsCounter < 0 instead of ==

}

public void testCustomErrorReportLimit() {
int customErrorReportLimit = 5;
Copy link
Member

Choose a reason for hiding this comment

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

custom error limit is never passed to context here, so test will fail after fixing shouldBeErrorReported()
please add unmarshaller.setProperty(UnmarshallerProperties.ERROR_REPORT_LIMIT, customErrorReportLimit); below int customErrorReportLimit = 5;

unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
}
catch (JAXBException e) {
assertThat(e.getMessage(), is(EXPECTED_ERROR_MESSAGE));
Copy link
Member

Choose a reason for hiding this comment

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

Due to return false; error in shouldBeErrorReported() this assertion is never called in any of test methods.

@lucalas
Copy link

lucalas commented Sep 4, 2018

@facundovs please can you fix reported issues?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants