jadams-tresys commented on a change in pull request #92: Update dependencies to 
their latest versions
URL: https://github.com/apache/incubator-daffodil/pull/92#discussion_r209671835
 
 

 ##########
 File path: 
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/ConvertTextNumberUnparser.scala
 ##########
 @@ -69,22 +72,36 @@ case class ConvertTextNumberUnparser[S](
     // difficult to assert. Could probably check this with TypeTags or Manifest
     // if we find this is not the case. Want something akin to:
     // Assert.invariant(value.isInstanceOf[S])
-
-    val strRep =
-      if (value == 0 && zeroRep.isDefined) {
-        zeroRep.get
-      } else {
-        // Needed because the DecimalFormat class of ICU will call
-        // doubleValue on scala's BigInt and BigDecimal because it
-        // doesn't recognize it as Java's BigInteger and BigDecimal.
-        // This caused large numbers to be truncated silently.
-        value match {
-          case bd: scala.math.BigDecimal => Assert.usageError("Received 
scala.math.BigDecimal, expected java.math.BigDecimal.")
-          case bi: scala.math.BigInt => Assert.usageError("Received 
scala.math.BigInt, expected java.math.BigInteger.")
-          case _ => // OK
+        
+    val df = nff.getNumFormat(state).get
+    val dfs = df.getDecimalFormatSymbols
+
+    val strRep = value match {
+      case n: Number if n == 0 && zeroRep.isDefined => zeroRep.get
+      // We need to special case infinity and NaN because ICU4J has a bug and
+      // will add an exponent to inf/nan (e.g. INFx10^0) if defined in the
+      // pattern, which we don't want. We need to manually output the inf/nan
+      // rep plus the prefix and suffix
+      case f: JFloat if f.isInfinite =>
 
 Review comment:
   I'll have to remember that idea for other projects in the future!

----------------------------------------------------------------
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