diff --git a/CHANGELOG.md b/CHANGELOG.md index 351adccf651..1e44012027c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,11 @@ supported. All DRS inputs to a task are now localized in a single PAPI action, which should improve speed and resolve failures observed when attempting to localize a large number of DRS files. +### Security Patching + +Updates to dependencies to fix security vulnerabilities. + + ## 84 Release Notes ### CromIAM enabled user checks diff --git a/backend/src/main/scala/cromwell/backend/standard/StandardCachingActorHelper.scala b/backend/src/main/scala/cromwell/backend/standard/StandardCachingActorHelper.scala index dd4254c8439..a64c6a5439c 100644 --- a/backend/src/main/scala/cromwell/backend/standard/StandardCachingActorHelper.scala +++ b/backend/src/main/scala/cromwell/backend/standard/StandardCachingActorHelper.scala @@ -78,7 +78,7 @@ trait StandardCachingActorHelper extends JobCachingActorHelper { val fileMetadata = jobPaths.metadataPaths - runtimeAttributesMetadata ++ fileMetadata ++ nonStandardMetadata + nonStandardMetadata ++ runtimeAttributesMetadata ++ fileMetadata } /** diff --git a/backend/src/main/scala/cromwell/backend/standard/callcaching/RootWorkflowFileHashCacheActor.scala b/backend/src/main/scala/cromwell/backend/standard/callcaching/RootWorkflowFileHashCacheActor.scala index e33625741b3..c3d1452660e 100644 --- a/backend/src/main/scala/cromwell/backend/standard/callcaching/RootWorkflowFileHashCacheActor.scala +++ b/backend/src/main/scala/cromwell/backend/standard/callcaching/RootWorkflowFileHashCacheActor.scala @@ -48,7 +48,7 @@ class RootWorkflowFileHashCacheActor private[callcaching](override val ioActor: // hash to become available. cache.put(key, FileHashValueRequested(requesters = requester :: requesters)) case FileHashSuccess(value) => - sender() ! Tuple2(hashCommand.fileHashContext, IoSuccess(requester.ioCommand, value)) + sender() ! Tuple2[Any, Any](hashCommand.fileHashContext, IoSuccess(requester.ioCommand, value)) case FileHashFailure(error) => sender() ! Tuple2(hashCommand.fileHashContext, IoFailure(requester.ioCommand, new IOException(error))) } diff --git a/centaur/src/it/scala/centaur/reporting/BigQueryReporter.scala b/centaur/src/it/scala/centaur/reporting/BigQueryReporter.scala index 16463742632..9a88a9ac109 100644 --- a/centaur/src/it/scala/centaur/reporting/BigQueryReporter.scala +++ b/centaur/src/it/scala/centaur/reporting/BigQueryReporter.scala @@ -189,7 +189,7 @@ class BigQueryReporter(override val params: ErrorReporterParams) extends ErrorRe } private def toJobKeyValueRow(jobKeyValueEntry: JobKeyValueEntry): RowToInsert = { - RowToInsert of Map( + RowToInsert of Map[String, Any]( "call_fully_qualified_name" -> jobKeyValueEntry.callFullyQualifiedName, "job_attempt" -> jobKeyValueEntry.jobAttempt, "job_index" -> jobKeyValueEntry.jobIndex, diff --git a/codegen_java/build.sbt b/codegen_java/build.sbt index 2ba35a693c3..0ad461a66b8 100644 --- a/codegen_java/build.sbt +++ b/codegen_java/build.sbt @@ -6,7 +6,7 @@ lazy val root = (project in file(".")). Seq(organization := "org.broadinstitute.cromwell", name := "cromwell-client", version := createVersion("0.1"), - scalaVersion := "2.13.8", + scalaVersion := "2.13.9", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), Compile / packageDoc / publishArtifact := false, diff --git a/common/src/main/scala/common/util/TerminalUtil.scala b/common/src/main/scala/common/util/TerminalUtil.scala index dab7fb9ce17..cb7c980aecb 100644 --- a/common/src/main/scala/common/util/TerminalUtil.scala +++ b/common/src/main/scala/common/util/TerminalUtil.scala @@ -6,10 +6,10 @@ object TerminalUtil { def maxWidth(lengths: Seq[Seq[Int]], column: Int) = lengths.map { length => length(column) }.max val widths = (rows :+ header).map { row => row.map { s => s.length } } val maxWidths = widths.head.indices.map { column => maxWidth(widths, column) } - val tableHeader = header.indices.map { i => header(i).padTo(maxWidths(i), " ").mkString("") }.mkString("|") + val tableHeader = header.indices.map { i => header(i).padTo(maxWidths(i), ' ').mkString("") }.mkString("|") val tableDivider = header.indices.map { i => "-" * maxWidths(i) }.mkString("|") val tableRows = rows.map { row => - val mdRow = row.indices.map { i => row(i).padTo(maxWidths(i), " ").mkString("") }.mkString("|") + val mdRow = row.indices.map { i => row(i).padTo(maxWidths(i), ' ').mkString("") }.mkString("|") s"|$mdRow|" } s"|$tableHeader|\n|$tableDivider|\n${tableRows.mkString("\n")}\n" diff --git a/common/src/test/scala/common/collections/EnhancedCollectionsSpec.scala b/common/src/test/scala/common/collections/EnhancedCollectionsSpec.scala index 12dba2e15d9..d2e0a38878c 100644 --- a/common/src/test/scala/common/collections/EnhancedCollectionsSpec.scala +++ b/common/src/test/scala/common/collections/EnhancedCollectionsSpec.scala @@ -11,7 +11,7 @@ class EnhancedCollectionsSpec extends AsyncFlatSpec with Matchers { behavior of "EnhancedCollections" it should "filter a List by type and return a List" in { - val objectList = List("hello", 3, None, "world") + val objectList = List[Any]("hello", 3, None, "world") val stringList = objectList.filterByType[String] stringList should be(List("hello", "world")) @@ -28,14 +28,14 @@ class EnhancedCollectionsSpec extends AsyncFlatSpec with Matchers { } it should "filter a Set by type and return a Set" in { - val objectSet = Set("hello", 3, None, "world") + val objectSet = Set[Any]("hello", 3, None, "world") val intSet: Set[Int] = objectSet.filterByType[Int] intSet should be(Set(3)) } it should "find the first Int in a List" in { - val objectSet = List("hello", 3, None, 4, "world") + val objectSet = List[Any]("hello", 3, None, 4, "world") objectSet.firstByType[Int] should be(Some(3)) } diff --git a/core/src/test/scala/cromwell/core/io/IoClientHelperSpec.scala b/core/src/test/scala/cromwell/core/io/IoClientHelperSpec.scala index f77df6fa011..06132ba152b 100644 --- a/core/src/test/scala/cromwell/core/io/IoClientHelperSpec.scala +++ b/core/src/test/scala/cromwell/core/io/IoClientHelperSpec.scala @@ -27,7 +27,7 @@ class IoClientHelperSpec extends TestKitSuite with AnyFlatSpecLike with Matchers val testActor = TestActorRef(new IoClientHelperTestActor(ioActorProbe.ref, delegateProbe.ref, backoff, noResponseTimeout)) val command = DefaultIoSizeCommand(mock[Path]) - val response = IoSuccess(command, 5) + val response = IoSuccess(command, 5L) // Send the command testActor.underlyingActor.sendMessage(command) @@ -58,7 +58,7 @@ class IoClientHelperSpec extends TestKitSuite with AnyFlatSpecLike with Matchers val commandContext = "context" val command = DefaultIoSizeCommand(mock[Path]) - val response = IoSuccess(command, 5) + val response = IoSuccess(command, 5L) // Send the command testActor.underlyingActor.sendMessageWithContext(commandContext, command) diff --git a/core/src/test/scala/cromwell/core/retry/BackoffSpec.scala b/core/src/test/scala/cromwell/core/retry/BackoffSpec.scala index 58fa597dc03..c6a008feb02 100644 --- a/core/src/test/scala/cromwell/core/retry/BackoffSpec.scala +++ b/core/src/test/scala/cromwell/core/retry/BackoffSpec.scala @@ -54,7 +54,7 @@ class BackoffSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers { it should "parse config" in { val config = ConfigFactory.parseMap( - Map( + Map[String, Any]( "min" -> "5 seconds", "max" -> "30 seconds", "multiplier" -> 6D, diff --git a/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/callcaching/FetchCachedResultsActor.scala b/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/callcaching/FetchCachedResultsActor.scala index 0eef565caf2..89745e6523d 100644 --- a/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/callcaching/FetchCachedResultsActor.scala +++ b/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/callcaching/FetchCachedResultsActor.scala @@ -37,7 +37,7 @@ class FetchCachedResultsActor(cacheResultId: CallCachingEntryId, replyTo: ActorR val sourceCacheDetails = Seq(result.callCachingEntry.workflowExecutionUuid, result.callCachingEntry.callFullyQualifiedName, - result.callCachingEntry.jobIndex).mkString(":") + result.callCachingEntry.jobIndex.toString).mkString(":") CachedOutputLookupSucceeded(simpletons, jobDetritusFiles.toMap, result.callCachingEntry.returnCode, diff --git a/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/job/EngineJobExecutionActor.scala b/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/job/EngineJobExecutionActor.scala index 3bbdb5eb1f2..4423de202cc 100644 --- a/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/job/EngineJobExecutionActor.scala +++ b/engine/src/main/scala/cromwell/engine/workflow/lifecycle/execution/job/EngineJobExecutionActor.scala @@ -753,7 +753,7 @@ class EngineJobExecutionActor(replyTo: ActorRef, private def logCacheHitSuccessAndNotifyMetadata(data: ResponsePendingData): Unit = { - val metadataMap = Map(callCachingHitResultMetadataKey -> true) ++ data.ejeaCacheHit.flatMap(_.details).map(details => callCachingReadResultMetadataKey -> s"Cache Hit: $details").toMap + val metadataMap = Map[String, Any](callCachingHitResultMetadataKey -> true) ++ data.ejeaCacheHit.flatMap(_.details).map(details => callCachingReadResultMetadataKey -> s"Cache Hit: $details").toMap writeToMetadata(metadataMap) diff --git a/engine/src/test/scala/cromwell/engine/workflow/lifecycle/ValidatingCachingConfigSpec.scala b/engine/src/test/scala/cromwell/engine/workflow/lifecycle/ValidatingCachingConfigSpec.scala index 40b628a700d..095721569e7 100644 --- a/engine/src/test/scala/cromwell/engine/workflow/lifecycle/ValidatingCachingConfigSpec.scala +++ b/engine/src/test/scala/cromwell/engine/workflow/lifecycle/ValidatingCachingConfigSpec.scala @@ -11,7 +11,7 @@ import scala.util.{Failure, Success, Try} class ValidatingCachingConfigSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers with TableDrivenPropertyChecks { it should "run config tests" in { - val cases = Table( + val cases = Table[String, Any]( ("config" , "exceptionMessage" ), ("enabled = not-a-boolean", "String: 1: enabled has type STRING rather than BOOLEAN" ), ("enabled = true" , true ), diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 50c76893e80..10dba1c3f7d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -89,7 +89,7 @@ object Dependencies { private val postgresV = "42.3.3" private val pprintV = "0.7.3" private val rdf4jV = "3.7.1" - private val refinedV = "0.9.29" + private val refinedV = "0.10.1" private val rhinoV = "1.7.14" private val scalaCollectionCompatV = "2.5.0" @@ -480,7 +480,8 @@ object Dependencies { val coreDependencies: List[ModuleID] = List( "com.google.auth" % "google-auth-library-oauth2-http" % googleOauth2V, "com.chuusai" %% "shapeless" % shapelessV, - "com.storm-enroute" %% "scalameter" % scalameterV % Test, + "com.storm-enroute" %% "scalameter" % scalameterV % Test + exclude("org.scala-lang.modules", "scala-xml_2.13"), "com.github.scopt" %% "scopt" % scoptV, ) ++ akkaStreamDependencies ++ configDependencies ++ catsDependencies ++ circeDependencies ++ googleApiClientDependencies ++ statsDDependencies ++ betterFilesDependencies ++ @@ -509,7 +510,8 @@ object Dependencies { "com.storm-enroute" %% "scalameter" % scalameterV exclude("com.fasterxml.jackson.core", "jackson-databind") exclude("com.fasterxml.jackson.module", "jackson-module-scala") - exclude("org.scala-tools.testing", "test-interface"), + exclude("org.scala-tools.testing", "test-interface") + exclude("org.scala-lang.modules", "scala-xml_2.13"), "com.fasterxml.jackson.core" % "jackson-databind" % jacksonV, "io.github.andrebeat" %% "scala-pool" % scalaPoolV ) ++ swaggerUiDependencies ++ akkaHttpDependencies ++ akkaHttpCirceIntegrationDependency ++ circeDependencies ++ diff --git a/project/Settings.scala b/project/Settings.scala index 951b1fc8fe6..797d7917dd9 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -70,7 +70,7 @@ object Settings { assembly / assemblyMergeStrategy := customMergeStrategy.value, ) - val Scala2_13Version = "2.13.8" + val Scala2_13Version = "2.13.9" private val ScalaVersion: String = Scala2_13Version private val sharedSettings: Seq[Setting[_]] = cromwellVersionWithGit ++ publishingSettings ++ List( diff --git a/project/plugins.sbt b/project/plugins.sbt index dd6a98e1b9b..34bccb47a0a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.9.0") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.1") addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.4") addDependencyTreePlugin diff --git a/services/src/main/scala/cromwell/services/instrumentation/impl/selectivetsv/SelectiveTsvInstrumentationServiceActor.scala b/services/src/main/scala/cromwell/services/instrumentation/impl/selectivetsv/SelectiveTsvInstrumentationServiceActor.scala index fd1864d45f0..4df3f966db6 100644 --- a/services/src/main/scala/cromwell/services/instrumentation/impl/selectivetsv/SelectiveTsvInstrumentationServiceActor.scala +++ b/services/src/main/scala/cromwell/services/instrumentation/impl/selectivetsv/SelectiveTsvInstrumentationServiceActor.scala @@ -143,7 +143,7 @@ object SelectiveTsvInstrumentationServiceActor { val header = (List("timestamp") ++ interestingFields).mkString("\t") val rows = stateHistory.map { case (timestamp, fieldMap) => - (Vector(timestamp.toString) ++ interestingFields.map(f => fieldMap.getOrElse(f, 0))).mkString("\t") + (Vector(timestamp.toString) ++ interestingFields.map(f => fieldMap.getOrElse(f, 0).toString)).mkString("\t") } Vector(header) ++ rows } diff --git a/services/src/test/scala/cromwell/services/metadata/impl/MetadataDatabaseAccessSpec.scala b/services/src/test/scala/cromwell/services/metadata/impl/MetadataDatabaseAccessSpec.scala index 8e6029140e9..2a812419775 100644 --- a/services/src/test/scala/cromwell/services/metadata/impl/MetadataDatabaseAccessSpec.scala +++ b/services/src/test/scala/cromwell/services/metadata/impl/MetadataDatabaseAccessSpec.scala @@ -287,7 +287,7 @@ class MetadataDatabaseAccessSpec extends AnyFlatSpec with CromwellTimeoutSpec wi } // Filter by workflow id within random Ids _ <- dataAccess.queryWorkflowSummaries(WorkflowQueryParameters( - (randomIds :+ workflow1Id).map(id => WorkflowQueryKey.Id.name -> id.toString))) map { case (response, _) => + (randomIds :+ workflow1Id.toString).map(id => WorkflowQueryKey.Id.name -> id))) map { case (response, _) => val resultsById = response.results groupBy { _.name } diff --git a/supportedBackends/google/pipelines/common/src/main/scala/cromwell/backend/google/pipelines/common/PipelinesApiJobCachingActorHelper.scala b/supportedBackends/google/pipelines/common/src/main/scala/cromwell/backend/google/pipelines/common/PipelinesApiJobCachingActorHelper.scala index 2e6682c2e69..353e33a5019 100644 --- a/supportedBackends/google/pipelines/common/src/main/scala/cromwell/backend/google/pipelines/common/PipelinesApiJobCachingActorHelper.scala +++ b/supportedBackends/google/pipelines/common/src/main/scala/cromwell/backend/google/pipelines/common/PipelinesApiJobCachingActorHelper.scala @@ -75,7 +75,7 @@ trait PipelinesApiJobCachingActorHelper extends StandardCachingActorHelper { .get(WorkflowOptionKeys.GoogleProject) .getOrElse(jesAttributes.project) - Map( + Map[String, Any]( PipelinesApiMetadataKeys.GoogleProject -> googleProject, PipelinesApiMetadataKeys.ExecutionBucket -> initializationData.workflowPaths.executionRootString, PipelinesApiMetadataKeys.EndpointUrl -> jesAttributes.endpointUrl, diff --git a/supportedBackends/google/pipelines/v2alpha1/src/main/scala/cromwell/backend/google/pipelines/v2alpha1/PipelinesApiAsyncBackendJobExecutionActor.scala b/supportedBackends/google/pipelines/v2alpha1/src/main/scala/cromwell/backend/google/pipelines/v2alpha1/PipelinesApiAsyncBackendJobExecutionActor.scala index a0f899a26ff..2da04c65e92 100644 --- a/supportedBackends/google/pipelines/v2alpha1/src/main/scala/cromwell/backend/google/pipelines/v2alpha1/PipelinesApiAsyncBackendJobExecutionActor.scala +++ b/supportedBackends/google/pipelines/v2alpha1/src/main/scala/cromwell/backend/google/pipelines/v2alpha1/PipelinesApiAsyncBackendJobExecutionActor.scala @@ -141,9 +141,9 @@ class PipelinesApiAsyncBackendJobExecutionActor(standardParams: StandardAsyncExe } val optional = Option(output) collectFirst { case o: PipelinesApiFileOutput if o.secondary || o.optional => "optional" } getOrElse "required" - val contentType = output.contentType.getOrElse("") + val contentType = output.contentType.map(_.toString).getOrElse("") - List(kind, output.cloudPath, output.containerPath, optional, contentType) + List(kind, output.cloudPath.toString, output.containerPath.toString, optional, contentType) } mkString("\"", "\"\n| \"", "\"") val parallelCompositeUploadThreshold = jobDescriptor.workflowDescriptor.workflowOptions.getOrElse( diff --git a/supportedBackends/google/pipelines/v2alpha1/src/test/scala/cromwell/backend/google/pipelines/v2alpha1/api/DeserializationSpec.scala b/supportedBackends/google/pipelines/v2alpha1/src/test/scala/cromwell/backend/google/pipelines/v2alpha1/api/DeserializationSpec.scala index 1c936e76317..7f10580b700 100644 --- a/supportedBackends/google/pipelines/v2alpha1/src/test/scala/cromwell/backend/google/pipelines/v2alpha1/api/DeserializationSpec.scala +++ b/supportedBackends/google/pipelines/v2alpha1/src/test/scala/cromwell/backend/google/pipelines/v2alpha1/api/DeserializationSpec.scala @@ -82,9 +82,9 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc "commands" -> List[String]("echo", "hello").asJava ).asJava ).asJava, - "resources" -> Map( + "resources" -> Map[String, Object]( "projectId" -> "project", - "virtualMachine" -> Map( + "virtualMachine" -> Map[String, Any]( "machineType" -> "custom-1-1024", "preemptible" -> false ).asJava @@ -117,7 +117,7 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc "commands" -> List[String]("echo", "hello").asJava ).asJava ).asJava, - "resources" -> Map( + "resources" -> Map[String, Object]( "projectId" -> "project", "virtualMachine" -> Map( "machineType" -> "custom-1-1024", diff --git a/supportedBackends/google/pipelines/v2beta/src/main/scala/cromwell/backend/google/pipelines/v2beta/PipelinesApiAsyncBackendJobExecutionActor.scala b/supportedBackends/google/pipelines/v2beta/src/main/scala/cromwell/backend/google/pipelines/v2beta/PipelinesApiAsyncBackendJobExecutionActor.scala index aa49c385ba6..fb6c8d425f7 100644 --- a/supportedBackends/google/pipelines/v2beta/src/main/scala/cromwell/backend/google/pipelines/v2beta/PipelinesApiAsyncBackendJobExecutionActor.scala +++ b/supportedBackends/google/pipelines/v2beta/src/main/scala/cromwell/backend/google/pipelines/v2beta/PipelinesApiAsyncBackendJobExecutionActor.scala @@ -146,9 +146,9 @@ class PipelinesApiAsyncBackendJobExecutionActor(standardParams: StandardAsyncExe } val optional = Option(output) collectFirst { case o: PipelinesApiFileOutput if o.secondary || o.optional => "optional" } getOrElse "required" - val contentType = output.contentType.getOrElse("") + val contentType = output.contentType.map(_.toString).getOrElse("") - List(kind, output.cloudPath, output.containerPath, optional, contentType) + List(kind, output.cloudPath.toString, output.containerPath.toString, optional, contentType) } mkString("\"", "\"\n| \"", "\"") val parallelCompositeUploadThreshold = jobDescriptor.workflowDescriptor.workflowOptions.getOrElse( diff --git a/supportedBackends/google/pipelines/v2beta/src/test/scala/cromwell/backend/google/pipelines/v2beta/api/DeserializationSpec.scala b/supportedBackends/google/pipelines/v2beta/src/test/scala/cromwell/backend/google/pipelines/v2beta/api/DeserializationSpec.scala index 37020b0b0d6..6afd75adbd6 100644 --- a/supportedBackends/google/pipelines/v2beta/src/test/scala/cromwell/backend/google/pipelines/v2beta/api/DeserializationSpec.scala +++ b/supportedBackends/google/pipelines/v2beta/src/test/scala/cromwell/backend/google/pipelines/v2beta/api/DeserializationSpec.scala @@ -81,9 +81,9 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc "commands" -> List[String]("echo", "hello").asJava ).asJava ).asJava, - "resources" -> Map( + "resources" -> Map[String, Object]( "projectId" -> "project", - "virtualMachine" -> Map( + "virtualMachine" -> Map[String, Any]( "machineType" -> "custom-1-1024", "preemptible" -> false ).asJava @@ -115,7 +115,7 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc "commands" -> List[String]("echo", "hello").asJava ).asJava ).asJava, - "resources" -> Map( + "resources" -> Map[String, Object]( "projectId" -> "project", "virtualMachine" -> Map( "machineType" -> "custom-1-1024", diff --git a/wdl/model/draft2/src/main/scala/wdl/draft2/model/AstTools.scala b/wdl/model/draft2/src/main/scala/wdl/draft2/model/AstTools.scala index c1f3c18242b..24194807f17 100644 --- a/wdl/model/draft2/src/main/scala/wdl/draft2/model/AstTools.scala +++ b/wdl/model/draft2/src/main/scala/wdl/draft2/model/AstTools.scala @@ -196,7 +196,7 @@ object AstTools { val pairType = womType.asInstanceOf[WomPairType] WomPair(subElements.head.womValue(pairType.leftType, wdlSyntaxErrorFormatter), subElements(1).womValue(pairType.rightType, wdlSyntaxErrorFormatter)) } else { - throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).getOrElse("No AST").toString})") + throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).map(_.toString).getOrElse("No AST")})") } } @@ -224,7 +224,7 @@ object AstTools { case a: Ast if a.getName == "TupleLiteral" => astTupleToValue(a) case a: Ast if a.getName == "MapLiteral" && womType.isInstanceOf[WomMapType] => astToMap(a) case a: Ast if a.getName == "ObjectLiteral" && womType == WomObjectType => astToObject(a) - case _ => throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).getOrElse("No AST").toString})") + case _ => throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).map(_.toString).getOrElse("No AST")})") } } } diff --git a/wom/src/test/scala/wom/types/WomFileTypeSpec.scala b/wom/src/test/scala/wom/types/WomFileTypeSpec.scala index 217c15964cc..c4a90fadb07 100644 --- a/wom/src/test/scala/wom/types/WomFileTypeSpec.scala +++ b/wom/src/test/scala/wom/types/WomFileTypeSpec.scala @@ -65,7 +65,7 @@ class WomFileTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers } } - lazy val failedCoercionTests = Table( + lazy val failedCoercionTests = Table[String, WomType, Any, String]( ("description", "womFileType", "value", "expected"), ("a double to a dir", WomUnlistedDirectoryType, 6.28318, diff --git a/wom/src/test/scala/wom/types/WomTypeSpec.scala b/wom/src/test/scala/wom/types/WomTypeSpec.scala index 01c5030806d..4d3c7befeb5 100644 --- a/wom/src/test/scala/wom/types/WomTypeSpec.scala +++ b/wom/src/test/scala/wom/types/WomTypeSpec.scala @@ -10,6 +10,7 @@ import wom.values._ import scala.runtime.ScalaRunTime import scala.util.Random +import scala.util.matching.Regex class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers { @@ -32,7 +33,7 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers { WomSingleFileType.stableName shouldEqual "File" } - val rawValuesCoercedToType = Table( + val rawValuesCoercedToType = Table[Any, WomType, Any, Regex]( ( "Raw Value", "WomType", @@ -43,33 +44,33 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers { WomString("hello"), WomIntegerType, classOf[NumberFormatException], - "For input string: \"hello\"" + "For input string: \"hello\"".r ), ( WomInteger(0), WomBooleanType, classOf[IllegalArgumentException], - """No coercion defined from wom value\(s\) '0' of type 'Int' to 'Boolean'.""" + """No coercion defined from wom value\(s\) '0' of type 'Int' to 'Boolean'.""".r ), ( 0, WomBooleanType, classOf[IllegalArgumentException], - "No coercion defined from '0' of type 'java.lang.Integer' to 'Boolean'." + "No coercion defined from '0' of type 'java.lang.Integer' to 'Boolean'.".r ), ( Array(0, 1, 2, 3, 4), WomBooleanType, classOf[IllegalArgumentException], - """No coercion defined from 'Array\(0, 1, 2\)' of type 'int\[\]' to 'Boolean'.""" + """No coercion defined from 'Array\(0, 1, 2\)' of type 'int\[\]' to 'Boolean'.""".r ), ( new AnyRef {}, WomBooleanType, classOf[IllegalArgumentException], - "No coercion defined from" + + ("No coercion defined from" + """ 'wom.types.WomTypeSpec\$\$anon\$(.*)@.*' of type""" + - """ 'wom.types.WomTypeSpec\$\$anon\$\1' to 'Boolean'.""" + """ 'wom.types.WomTypeSpec\$\$anon\$\1' to 'Boolean'.""").r ), ( WomArray(WomArrayType(WomOptionalType(WomIntegerType)), Seq( @@ -81,19 +82,19 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers { ), WomOptionalType(WomMaybeEmptyArrayType(WomIntegerType)), classOf[IllegalArgumentException], - """No coercion defined from wom value\(s\) '\[0, 1, 2\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""" + """No coercion defined from wom value\(s\) '\[0, 1, 2\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""".r ), ( WomArray(WomArrayType(WomOptionalType(WomIntegerType)), Seq(WomOptionalValue.none(WomIntegerType))), WomOptionalType(WomMaybeEmptyArrayType(WomIntegerType)), classOf[IllegalArgumentException], - """No coercion defined from wom value\(s\) '\[null\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""" + """No coercion defined from wom value\(s\) '\[null\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""".r ), ( WomOptionalValue.none(WomArrayType(WomIntegerType)), WomMaybeEmptyArrayType(WomOptionalType(WomIntegerType)), classOf[IllegalArgumentException], - """No coercion defined from wom value\(s\) 'null' of type 'Array\[Int\]\?' to 'Array\[Int\?\]'.""" + """No coercion defined from wom value\(s\) 'null' of type 'Array\[Int\]\?' to 'Array\[Int\?\]'.""".r ) )