Skip to content

java.nio.charset.UnmappableCharacterException: Input length = 1 #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tamasmartin opened this issue Dec 1, 2016 · 2 comments
Closed

Comments

@tamasmartin
Copy link

tamasmartin commented Dec 1, 2016

I am getting this exception when I run coverageReport task.

The stacktrace is:
java.nio.charset.UnmappableCharacterException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:282) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.read(BufferedReader.java:182) at scala.io.BufferedSource$$anonfun$iter$1$$anonfun$apply$mcI$sp$1.apply$mcI$sp(BufferedSource.scala:38) at scala.io.Codec.wrap(Codec.scala:68) at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38) at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38) at scala.collection.Iterator$$anon$9.next(Iterator.scala:162) at scala.collection.Iterator$$anon$17.hasNext(Iterator.scala:511) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.io.Source.hasNext(Source.scala:226) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at scala.io.Source.foreach(Source.scala:178) at scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320) at scala.io.Source.addString(Source.scala:178) at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286) at scala.io.Source.mkString(Source.scala:178) at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:288) at scala.io.Source.mkString(Source.scala:178) at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:290) at scala.io.Source.mkString(Source.scala:178) at scoverage.report.CodeGrid.source(CodeGrid.scala:63) at scoverage.report.CodeGrid.<init>(CodeGrid.scala:17) at scoverage.report.ScoverageHtmlWriter.filePage(ScoverageHtmlWriter.scala:78) at scoverage.report.ScoverageHtmlWriter.scoverage$report$ScoverageHtmlWriter$$writeFile(ScoverageHtmlWriter.scala:44) at scoverage.report.ScoverageHtmlWriter$$anonfun$scoverage$report$ScoverageHtmlWriter$$writePackage$1.apply(ScoverageHtmlWriter.scala:37) at scoverage.report.ScoverageHtmlWriter$$anonfun$scoverage$report$ScoverageHtmlWriter$$writePackage$1.apply(ScoverageHtmlWriter.scala:37) at scala.collection.immutable.List.foreach(List.scala:318) at scoverage.report.ScoverageHtmlWriter.scoverage$report$ScoverageHtmlWriter$$writePackage(ScoverageHtmlWriter.scala:37) at scoverage.report.ScoverageHtmlWriter$$anonfun$write$1.apply(ScoverageHtmlWriter.scala:27) at scoverage.report.ScoverageHtmlWriter$$anonfun$write$1.apply(ScoverageHtmlWriter.scala:27) at scala.collection.immutable.List.foreach(List.scala:318) at scoverage.report.ScoverageHtmlWriter.write(ScoverageHtmlWriter.scala:27) at scoverage.ScoverageSbtPlugin$.scoverage$ScoverageSbtPlugin$$writeReports(ScoverageSbtPlugin.scala:178) at scoverage.ScoverageSbtPlugin$$anonfun$coverageReport0$1.apply(ScoverageSbtPlugin.scala:70) at scoverage.ScoverageSbtPlugin$$anonfun$coverageReport0$1.apply(ScoverageSbtPlugin.scala:61) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [error] (*:coverageReport) java.nio.charset.UnmappableCharacterException: Input length = 1 [error] Total time: 4 s, completed Nov 30, 2016 5:28:00 PM
I have attached the scoverage.coverage.xml file
Could you please provide a workaround or fix it if possible?
Thanks a lot.

@gslowikowski
Copy link
Member

Your system encoding does not match the encoding of source files.

You have to add Seq("-encoding", "proper_encoding") to scalacOptions setting in build.sbt file (where "proper_encoding" is encoding used in source files) or fix sources if encoding of non-ascii characters is not consistent.

@tamasmartin
Copy link
Author

Thank you @gslowikowski , it saved me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants