Skip to content

Refactor service-provider parsers handling streams #17

@poikilotherm

Description

@poikilotherm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestservice-providerRelated to Service Provider implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions