mike-mcgann commented on code in PR #988:
URL: https://github.com/apache/daffodil/pull/988#discussion_r1146698565
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/Parser.scala:
##########
@@ -90,6 +85,53 @@ sealed trait Parser extends Processor {
)
}
+ def PENotEnoughBits(
Review Comment:
There is one place that passes in a None or Nope here so I created a new
constructor that doesn't take this argument in that case.
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HexBinaryLengthParsers.scala:
##########
@@ -64,9 +64,12 @@ sealed abstract class HexBinaryLengthParser(override val
context: ElementRuntime
// limiting the size of hex binarie data.
val array = new Array[Byte](nBytes.toInt)
val buffer = ByteBuffer.wrap(array)
- writeBitsInChunks(start, nBits) { case (bytes, nBytes) =>
+ val written = writeBitsInChunks(start, nBits) { case (bytes, nBytes) =>
buffer.put(bytes, 0, nBytes)
}
+ if (written != nBits) {
+ PENotEnoughBits(start, nBits, start.dataInputStream)
+ }
Review Comment:
Updated
--
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]