stevedlawrence commented on a change in pull request #448:
URL: https://github.com/apache/incubator-daffodil/pull/448#discussion_r512688827
##########
File path:
daffodil-io/src/main/scala/org/apache/daffodil/io/DirectOrBufferedDataOutputStream.scala
##########
@@ -885,8 +885,10 @@ class DirectOrBufferedDataOutputStream private[io] (
bufOS.getFile.delete()
}
nBitsPut / 8
- } else
- directDOS.putBytes(bufOS.getBuf, 0, nBytes, finfo)
+ } else {
+ Assert.usage(nBytes <= Int.MaxValue)
Review comment:
I assume you're talking about:
```scala
abstract class LocalBuffer[T <: java.nio.Buffer] {
def getBuf(length: Long) = {
Assert.usage(length <= Int.MaxValue)
...
}
}
```
In this case, I think Assert.usage is correct because it's enforcing an
assumption about the parameter value, and ensuring uses of this function don't
break this assumption. So Assert.usage is sortof saying "XYZ shouldn't be used
this way", whereas Assert.invariant says "XYZ shouldn't be possible". It's
fairly pretty subtle difference, and I think these two checks are slightly
different.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]