stevedlawrence commented on a change in pull request #86: Adding value of 'bcd' 
to binaryCalendarRep
URL: https://github.com/apache/incubator-daffodil/pull/86#discussion_r205430313
 
 

 ##########
 File path: 
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/PackedBinaryUnparserTraits.scala
 ##########
 @@ -45,7 +46,16 @@ abstract class PackedBinaryBaseUnparser(
   override def unparse(state: UState): Unit = {
     val nBits = getBitLength(state)
     val node = state.currentInfosetNode.asSimple
-    val value = node.dataValue.asInstanceOf[JNumber]
+
+    // If this is unparsing a binary calendar use node.dataValueAsString and 
create a JBigDecimal
+    //   so it can be cast to a JNumber below.
+    val nodeValue =
+      node.erd.optPrimType.get match {
+      case _: NodeInfo.Date.Kind | _: NodeInfo.DateTime.Kind | _: 
NodeInfo.Time.Kind => new JBigDecimal(node.dataValueAsString)
 
 Review comment:
   If it's possible to switch to the BCDInteger* parsers, this can then be a 
JBigInteger
   
   Also, I don't think you don't need the _: in the cases. We're probably not 
very consistent about it, but not having it is preferred.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to