open-simulation-platform / libcosim

OSP C++ co-simulation library
https://open-simulation-platform.github.io/libcosim
Mozilla Public License 2.0
55 stars 10 forks source link

parseURI null check and error handling implemented #710

Closed khanrn closed 11 months ago

khanrn commented 2 years ago

Although, only null check was suggested in the comment, implemented error handling too. And used the same message for both error handling and null check, which could be a bit confusing sometime. Feedback on these from the maintainers would be quite helpful.

NB. All the tests passed though. Selection_010

restenb commented 1 year ago

The error handler seems to be in place on the master branch already, though I don't recall which PR it was or when. In other words, the line

parser->getDomConfig()->setParameter(xercesc::XMLUni::fgDOMErrorHandler, &errorHandler);

is already there in current master and doesn't need to be duplicated here.

The error handler implementation seems to do it's own logging, so I'm not sure checking for errorHandler.failed() at the end is necessary.

The null check is fine probably, though I'm not familiar enough with Xerces to know when the parser would return null. So from where I stand at least I'd only keep the null check from this PR.

khanrn commented 1 year ago

Almost forgot about this PR! Will update it some time around next week.