mirror of https://github.com/sbt/sbt.git
Merge pull request #1490 from sbt/wip/1484
Fixes NullPointerException during update. Fixes #1484
This commit is contained in:
commit
e9b79c5956
|
|
@ -58,6 +58,13 @@ object IvyRetrieve {
|
||||||
moduleIds map { moduleDetail }
|
moduleIds map { moduleDetail }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private[sbt] def nonEmptyString(s: String): Option[String] =
|
||||||
|
s match {
|
||||||
|
case null => None
|
||||||
|
case x if x.trim == "" => None
|
||||||
|
case x => Some(x.trim)
|
||||||
|
}
|
||||||
|
|
||||||
private[sbt] def moduleRevisionDetail(confReport: ConfigurationResolveReport, dep: IvyNode): ModuleReport = {
|
private[sbt] def moduleRevisionDetail(confReport: ConfigurationResolveReport, dep: IvyNode): ModuleReport = {
|
||||||
def toExtraAttributes(ea: ju.Map[_, _]): Map[String, String] =
|
def toExtraAttributes(ea: ju.Map[_, _]): Map[String, String] =
|
||||||
Map(ea.entrySet.toArray collect {
|
Map(ea.entrySet.toArray collect {
|
||||||
|
|
@ -71,25 +78,29 @@ object IvyRetrieve {
|
||||||
}
|
}
|
||||||
val revId = dep.getResolvedId
|
val revId = dep.getResolvedId
|
||||||
val moduleId = toModuleID(revId)
|
val moduleId = toModuleID(revId)
|
||||||
val branch = Option(revId.getBranch)
|
val branch = nonEmptyString(revId.getBranch)
|
||||||
val (status, publicationDate, resolver, artifactResolver) = dep.isLoaded match {
|
val (status, publicationDate, resolver, artifactResolver) = dep.isLoaded match {
|
||||||
case true =>
|
case true =>
|
||||||
(Option(dep.getDescriptor.getStatus),
|
(nonEmptyString(dep.getDescriptor.getStatus),
|
||||||
Some(new ju.Date(dep.getPublication)),
|
Some(new ju.Date(dep.getPublication)),
|
||||||
Option(dep.getModuleRevision.getResolver.getName),
|
nonEmptyString(dep.getModuleRevision.getResolver.getName),
|
||||||
Option(dep.getModuleRevision.getArtifactResolver.getName))
|
nonEmptyString(dep.getModuleRevision.getArtifactResolver.getName))
|
||||||
case _ => (None, None, None, None)
|
case _ => (None, None, None, None)
|
||||||
}
|
}
|
||||||
val (evicted, evictedData, evictedReason) = dep.isEvicted(confReport.getConfiguration) match {
|
val (evicted, evictedData, evictedReason) = dep.isEvicted(confReport.getConfiguration) match {
|
||||||
case true =>
|
case true =>
|
||||||
val ed = dep.getEvictedData(confReport.getConfiguration)
|
val edOpt = Option(dep.getEvictedData(confReport.getConfiguration))
|
||||||
(true,
|
edOpt match {
|
||||||
Some(Option(ed.getConflictManager) map { _.toString } getOrElse { "transitive" }),
|
case Some(ed) =>
|
||||||
Option(ed.getDetail))
|
(true,
|
||||||
|
nonEmptyString(Option(ed.getConflictManager) map { _.toString } getOrElse { "transitive" }),
|
||||||
|
nonEmptyString(ed.getDetail))
|
||||||
|
case None => (true, None, None)
|
||||||
|
}
|
||||||
case _ => (false, None, None)
|
case _ => (false, None, None)
|
||||||
}
|
}
|
||||||
val problem = dep.hasProblem match {
|
val problem = dep.hasProblem match {
|
||||||
case true => Option(dep.getProblem.getMessage)
|
case true => nonEmptyString(dep.getProblem.getMessage)
|
||||||
case _ => None
|
case _ => None
|
||||||
}
|
}
|
||||||
val mdOpt = for {
|
val mdOpt = for {
|
||||||
|
|
@ -98,7 +109,7 @@ object IvyRetrieve {
|
||||||
} yield md
|
} yield md
|
||||||
val homepage = mdOpt match {
|
val homepage = mdOpt match {
|
||||||
case Some(md) =>
|
case Some(md) =>
|
||||||
Option(md.getHomePage)
|
nonEmptyString(md.getHomePage)
|
||||||
case _ => None
|
case _ => None
|
||||||
}
|
}
|
||||||
val extraAttributes: Map[String, String] = toExtraAttributes(mdOpt match {
|
val extraAttributes: Map[String, String] = toExtraAttributes(mdOpt match {
|
||||||
|
|
@ -110,7 +121,7 @@ object IvyRetrieve {
|
||||||
val licenses: Seq[(String, Option[String])] = mdOpt match {
|
val licenses: Seq[(String, Option[String])] = mdOpt match {
|
||||||
case Some(md) => md.getLicenses.toArray.toVector collect {
|
case Some(md) => md.getLicenses.toArray.toVector collect {
|
||||||
case lic: IvyLicense =>
|
case lic: IvyLicense =>
|
||||||
(lic.getName, Option(lic.getUrl))
|
(lic.getName, nonEmptyString(lic.getUrl))
|
||||||
}
|
}
|
||||||
case _ => Nil
|
case _ => Nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1286,7 +1286,17 @@ object Classpaths {
|
||||||
case (_, Some(out)) if uptodate(inChanged, out) => out
|
case (_, Some(out)) if uptodate(inChanged, out) => out
|
||||||
case _ => work(in)
|
case _ => work(in)
|
||||||
}
|
}
|
||||||
outCache(in)
|
try {
|
||||||
|
outCache(in)
|
||||||
|
} catch {
|
||||||
|
case e: NullPointerException =>
|
||||||
|
val r = work(in)
|
||||||
|
log.warn("Update task has failed to cache the report due to null.")
|
||||||
|
log.warn("Report the following output to sbt:")
|
||||||
|
r.toString.lines foreach { log.warn(_) }
|
||||||
|
log.trace(e)
|
||||||
|
r
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val f = if (skip && !force) skipWork else doWork
|
val f = if (skip && !force) skipWork else doWork
|
||||||
f(module.owner.configuration :+: module.moduleSettings :+: config :+: HNil)
|
f(module.owner.configuration :+: module.moduleSettings :+: config :+: HNil)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
[1467]: https://github.com/sbt/sbt/pull/1467
|
[1467]: https://github.com/sbt/sbt/pull/1467
|
||||||
[1476]: https://github.com/sbt/sbt/pull/1476
|
[1476]: https://github.com/sbt/sbt/pull/1476
|
||||||
[1477]: https://github.com/sbt/sbt/pull/1477
|
[1477]: https://github.com/sbt/sbt/pull/1477
|
||||||
|
[1484]: https://github.com/sbt/sbt/issues/1484
|
||||||
[1486]: https://github.com/sbt/sbt/pull/1486
|
[1486]: https://github.com/sbt/sbt/pull/1486
|
||||||
[1487]: https://github.com/sbt/sbt/pull/1487
|
[1487]: https://github.com/sbt/sbt/pull/1487
|
||||||
[1488]: https://github.com/sbt/sbt/pull/1488
|
[1488]: https://github.com/sbt/sbt/pull/1488
|
||||||
|
|
@ -53,6 +54,10 @@
|
||||||
[@henrikengstrom]: https://github.com/henrikengstrom
|
[@henrikengstrom]: https://github.com/henrikengstrom
|
||||||
[@puffnfresh]: https://github.com/puffnfresh
|
[@puffnfresh]: https://github.com/puffnfresh
|
||||||
|
|
||||||
|
### Changes since 0.13.6-M1
|
||||||
|
|
||||||
|
- Fixes `NullPointerException` during `update`. [#1484][1484] by [@eed3si9n][@eed3si9n]
|
||||||
|
|
||||||
### Fixes with compatibility implications
|
### Fixes with compatibility implications
|
||||||
|
|
||||||
- `ThisProject` used to resolve to the root project in a build even when it's place in `subproj/build.sbt`. sbt 0.13.6 fixes it to resolve to the sub project. [#1194][1194]/[#1358][1358] by [@dansanduleac][@dansanduleac]
|
- `ThisProject` used to resolve to the root project in a build even when it's place in `subproj/build.sbt`. sbt 0.13.6 fixes it to resolve to the sub project. [#1194][1194]/[#1358][1358] by [@dansanduleac][@dansanduleac]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
scalaVersion := "2.10.4"
|
||||||
|
|
||||||
|
conflictManager := ConflictManager.strict.copy(organization = "^(?!org\\.scala-lang).*$")
|
||||||
|
|
||||||
|
libraryDependencies += "org.specs2" %% "specs2" % "2.3.10-scalaz-7.1.0-M6" % "test"
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> update
|
||||||
Loading…
Reference in New Issue