mirror of https://github.com/sbt/sbt.git
wuw
This commit is contained in:
parent
fc38828818
commit
2f0eb1dba8
|
|
@ -957,8 +957,6 @@ object Cache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val utf8Bom = "\ufeff"
|
|
||||||
|
|
||||||
def fetch(
|
def fetch(
|
||||||
cache: File = default,
|
cache: File = default,
|
||||||
cachePolicy: CachePolicy = CachePolicy.UpdateChanging,
|
cachePolicy: CachePolicy = CachePolicy.UpdateChanging,
|
||||||
|
|
@ -981,7 +979,7 @@ object Cache {
|
||||||
def notFound(f: File) = Left(s"${f.getCanonicalPath} not found")
|
def notFound(f: File) = Left(s"${f.getCanonicalPath} not found")
|
||||||
|
|
||||||
def read(f: File) =
|
def read(f: File) =
|
||||||
try Right(new String(FileUtil.readAllBytes(f), "UTF-8").stripPrefix(utf8Bom))
|
try Right(new String(FileUtil.readAllBytes(f), "UTF-8"))
|
||||||
catch {
|
catch {
|
||||||
case NonFatal(e) =>
|
case NonFatal(e) =>
|
||||||
Left(s"Could not read (file:${f.getCanonicalPath}): ${e.getMessage}")
|
Left(s"Could not read (file:${f.getCanonicalPath}): ${e.getMessage}")
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,11 @@ package object compatibility {
|
||||||
def letter = c.isLetter
|
def letter = c.isLetter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val utf8Bom = "\ufeff"
|
||||||
|
|
||||||
def xmlParse(s: String): Either[String, Xml.Node] = {
|
def xmlParse(s: String): Either[String, Xml.Node] = {
|
||||||
def parse =
|
def parse =
|
||||||
try Right(scala.xml.XML.loadString(s))
|
try Right(scala.xml.XML.loadString(s.stripPrefix(utf8Bom)))
|
||||||
catch { case e: Exception => Left(e.toString + Option(e.getMessage).fold("")(" (" + _ + ")")) }
|
catch { case e: Exception => Left(e.toString + Option(e.getMessage).fold("")(" (" + _ + ")")) }
|
||||||
|
|
||||||
def fromNode(node: scala.xml.Node): Xml.Node =
|
def fromNode(node: scala.xml.Node): Xml.Node =
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,14 @@ object CentralTests extends TestSuite {
|
||||||
)
|
)
|
||||||
.process
|
.process
|
||||||
.run(fetch)
|
.run(fetch)
|
||||||
|
.map { res =>
|
||||||
|
|
||||||
|
assert(res.metadataErrors.isEmpty)
|
||||||
|
assert(res.conflicts.isEmpty)
|
||||||
|
assert(res.isDone)
|
||||||
|
|
||||||
|
res
|
||||||
|
}
|
||||||
.runF
|
.runF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue