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

Check if valid FpML document #1982

Merged
merged 2 commits into from May 29, 2019

Conversation

Projects
None yet
2 participants
@jodastephen
Copy link
Member

commented May 24, 2019

Provide method to check if document is FpML.
Build on top of filtered parse method in XmlFile.

Check if valid FpML document
Provide method to check if document is FpML
Build on top of filtered parse method in `XmlFile`
* Parses the element names and structure from the specified XML, filtering to reduce memory usage.
* <p>
* This parses the specified byte source expecting an XML file format.
* The filter function should return the number of levels below the current one

This comment has been minimized.

Copy link
@headphonejack

headphonejack May 28, 2019

Contributor

The filter function operates on the element name and... maybe?

* This parses the specified byte source expecting an XML file format.
* The filter function should return the number of levels below the current one
* that should be included in the response.
* Always returning {@code Integer.MAX_VALUE} will not filter the children.

This comment has been minimized.

Copy link
@headphonejack

headphonejack May 28, 2019

Contributor

So the range of Integer.MIN_VALUE <= x < 0 is invalid values? Talking of which Integer.MIN_VALUE could cause interesting behaviour underflowing back to MAX_VALUE, which would remain for all children, and have the same effect as MAX_VALUE!

* <p>
* Sometimes, the FpML document is embedded in a non-FpML wrapper.
* This method will intelligently find the FpML document at the root or within one or two levels
* of wrapper by searching for an element that contains both {@code <trade>} and {@code <party>}.

This comment has been minimized.

Copy link
@headphonejack

headphonejack May 28, 2019

Contributor

of wrapper missing a word?

@@ -216,7 +272,7 @@ private static XmlElement findFpmlRoot(XmlElement root) {
}
}
}
throw new FpmlParseException("Unable to find FpML root element");
return null;

This comment has been minimized.

Copy link
@headphonejack

headphonejack May 28, 2019

Contributor

Is this a deliberate decision to avoid Optional for performance?

This comment has been minimized.

Copy link
@jodastephen

jodastephen May 28, 2019

Author Member

There is no need to use Optional between two private methods of the same class. Sometimes it may make sense for other reasons, but didn't seem to do so here.

@jodastephen jodastephen merged commit bcfb572 into master May 29, 2019

15 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk - examples/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/calc/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/collect/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/data/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/loader/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/market/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/math/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/measure/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/product/pom.xml (OpenGamma) No new issues
Details
security/snyk - modules/report/pom.xml (OpenGamma) No new issues
Details
security/snyk - pom.xml (OpenGamma) No new issues
Details
workflow Workflow: workflow
Details

@delete-merged-branch delete-merged-branch bot deleted the topic/fpml branch May 29, 2019

@jodastephen jodastephen added this to the v2.4 milestone May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.