You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Provide a reader instance, so the stream control is in the hand of the calling code.
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.
The text was updated successfully, but these errors were encountered:
Currently parsers in package
io.gdcc.xoai.serviceprovider.parsers
are handed over anInputStream
as constructor arguments. They build and save aXmlReader
from this as class variable. This is bad, as the reader does not get burned (closed) after reading.Two ways to refactor:
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.
The text was updated successfully, but these errors were encountered: