You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/07/26 12:17:32 UTC

[GitHub] stevedlawrence commented on a change in pull request #86: Adding value of 'bcd' to binaryCalendarRep

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_r205433137
 
 

 ##########
 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.
 
 Review comment:
   It would be good to explain *why* we need to use dataValueAsString rather than dataValue (e.g. packed date time uses the convert combinator which sets the string value of the calendar--if we used dataValue we would get the Calendar value rather than that string. On the otherhand, with packed numbers, dataValue is already a number so we just want to use that, etc.).
   
   Based on the code, it's clear that unparsing a packed binary calendar uses dataValueAsString, but it's not immediately clear why that's necessary.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services