Skip to content

Fix reading of jar resource files for dottydoc #2546

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

Merged
merged 1 commit into from
May 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ trait ResourceFinder {
final case class ResourceNotFoundException(message: String) extends Exception(message)

protected def getResource(r: String): String =
Option(getClass.getResourceAsStream(r)).map(scala.io.Source.fromInputStream)
Option(getClass.getResourceAsStream(r))
.map(scala.io.Source.fromInputStream(_)(scala.io.Codec.UTF8))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't hardcode it. Use Properties.sourceEncoding that all the other compiler parts use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it needs to be hardcoded here. This is just reading of assets from the jar, it has nothing to do with compiling sources. This is guaranteed to always be UTF8.

.map(_.mkString)
.getOrElse(throw ResourceNotFoundException(r))

}