stevedlawrence commented on a change in pull request #371:
URL: https://github.com/apache/incubator-daffodil/pull/371#discussion_r415901977
##########
File path:
daffodil-io/src/main/scala/org/apache/daffodil/processors/charset/CharsetUtils.scala
##########
@@ -271,11 +271,7 @@ trait EncoderDecoderMixin
val truncString = cb.toString()
truncString
}
- case _ if cr.isMalformed() => {
- cr.throwException()
- ""
- }
- case _ if cr.isUnmappable() => {
+ case _ if cr.isMalformed() || cr.isUnmappable=> {
cr.throwException()
""
Review comment:
The problem is that ``cr`` is a Java
[CoderResult](https://docs.oracle.com/javase/7/docs/api/java/nio/charset/CoderResult.html),
and it's throwException just returns void, so Scala can't know that it will
always throw an exception and whatever follows it doesn't matter. Returning an
empty string is a codepath that is impossible to hit so it doesn't really
matter what is returned here. Maybe instead of returning empty string it should
be Assert.impossible() or something? Assert.impossible does return Nothing so
it should make the scala compiler happy.
----------------------------------------------------------------
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]