stevedlawrence commented on code in PR #1187:
URL: https://github.com/apache/daffodil/pull/1187#discussion_r1534441546


##########
daffodil-japi/src/main/scala/org/apache/daffodil/japi/io/InputSourceDataInputStream.scala:
##########
@@ -66,4 +66,6 @@ class InputSourceDataInputStream private[japi] (
    * been consumed or some data is left-over.
    */
   def hasData(): Boolean = dis.isDefinedForLength(1)
+
+  def close(): Unit = dis.close()

Review Comment:
   Grepping for non-test instances where we call the InputSourceDataInputStream 
constructor/apply function I think the only other place I see is in the 
DaffodilparseXMLReader (the Daffodil SAX API). I think these three parse 
functions might want to close the ISDIS they create?
   
   ```scala
   def parse(input: InputSource): Unit
   def parse(stream: InputStream): Unit
   def parse(arr: Array[Byte]): Unit
   ```
   Technically the `Array[Byte]` once doesn't need it since that can't be 
closed, but it won't hurt anything to call it, and is maybe technically correct 
just in case some day is does do some clean up or something.
   
   Note that we probably shouldn't call close() in this one:
   ```scala
   def parse(isdis: InputSourceDataInputStream): Unit
   ```
   Since the user provided the isdis and they are responsible for closing it 
when they are done with it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to