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

Refactor service-provider parsers handling streams #17

Open
poikilotherm opened this issue May 12, 2022 · 2 comments
Open

Refactor service-provider parsers handling streams #17

poikilotherm opened this issue May 12, 2022 · 2 comments
Labels
enhancement New feature or request service-provider Related to Service Provider implementation

Comments

@poikilotherm
Copy link
Member

Currently parsers in package io.gdcc.xoai.serviceprovider.parsers are handed over an InputStream as constructor arguments. They build and save a XmlReader from this as class variable. This is bad, as the reader does not get burned (closed) after reading.

Two ways to refactor:

  1. Provide a reader instance, so the stream control is in the hand of the calling code.
  2. Provide the stream, but create the reader on the fly when calling code comes for parse(), using a try-with-resources.

Preferred approach: Do 2. Plus: make the parsing static. No need for instances. Make the stream be passed on then, to make it more explicit where the action happens.

@poikilotherm
Copy link
Member Author

@landreev would this help?

@poikilotherm poikilotherm added enhancement New feature or request service-provider Related to Service Provider implementation labels Jun 30, 2023
@poikilotherm
Copy link
Member Author

THis might be related to #141, as it could touch on reading the metadata response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request service-provider Related to Service Provider implementation
Projects
None yet
Development

No branches or pull requests

1 participant