From a85502927ce23298866a9b4490406b0c9f54d750 Mon Sep 17 00:00:00 2001 From: "Francois @fanf42 Armand" Date: Fri, 14 Jun 2024 15:10:44 +0200 Subject: [PATCH] Fixes #24986: Enable scala 3 cross compilation --- .../marshalling/XmlUnserialisationImpl.scala | 38 ++++++++++--------- .../rudder/rest/RudderJsonResponse.scala | 2 +- .../rudder/web/services/DisplayNode.scala | 3 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/webapp/sources/rudder/rudder-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala b/webapp/sources/rudder/rudder-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala index 1fe10dc7b91..2c1fb625245 100644 --- a/webapp/sources/rudder/rudder-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala +++ b/webapp/sources/rudder/rudder-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala @@ -271,23 +271,25 @@ class NodeGroupUnserialisationImpl( tryo(s.text.toBoolean) ) ?~! ("Missing attribute 'isSystem' in entry type nodeGroup : " + entry) properties: Seq[GroupProperty] <- traverse(group \ "properties" \ "property") { p => - val name = (p \ "name").text.trim - if (name.isEmpty) { - Failure(s"Found unexpected xml under tag (name is blank): ${p}") - } else { - GroupProperty - .parse( - name, - ParseRev((p \ "revision").text.trim), - StringEscapeUtils.unescapeXml((p \ "value").text.trim): @nowarn( - "msg=class StringEscapeUtils in package lang3 is deprecated" - ), - (p \ "inheritMode").headOption.flatMap(p => InheritMode.parseString(p.text.trim).toOption), - (p \ "provider").headOption.map(p => PropertyProvider(p.text.trim)) - ) - .toBox - } - } + val name = (p \ "name").text.trim + if (name.isEmpty) { + Failure(s"Found unexpected xml under tag (name is blank): ${p}") + } else { + GroupProperty + .parse( + name, + ParseRev((p \ "revision").text.trim), + StringEscapeUtils.unescapeXml((p \ "value").text.trim): @nowarn( + "msg=class StringEscapeUtils in package lang3 is deprecated" + ), + (p \ "inheritMode").headOption.flatMap(p => + InheritMode.parseString(p.text.trim).toOption + ), + (p \ "provider").headOption.map(p => PropertyProvider(p.text.trim)) + ) + .toBox + } + } } yield { NodeGroup( id = id, @@ -851,7 +853,7 @@ class ApiAccountUnserialisationImpl extends ApiAccountUnserialisation { Full(ApiAuthorization.RO) case Some(Text(text)) if text == ApiAuthorizationKind.RW.name => Full(ApiAuthorization.RW) - case Some(xml @ {_*}) if xml.child.nonEmpty => unserAcl(xml.child.head) + case Some(xml @ {_*}) if xml.child.nonEmpty => unserAcl(xml.child.head) // all other case: serialization pb => None case _ => Full(ApiAuthorization.None) } diff --git a/webapp/sources/rudder/rudder-rest/src/main/scala/com/normation/rudder/rest/RudderJsonResponse.scala b/webapp/sources/rudder/rudder-rest/src/main/scala/com/normation/rudder/rest/RudderJsonResponse.scala index cc4b6db3ef7..5097f4ce42f 100644 --- a/webapp/sources/rudder/rudder-rest/src/main/scala/com/normation/rudder/rest/RudderJsonResponse.scala +++ b/webapp/sources/rudder/rudder-rest/src/main/scala/com/normation/rudder/rest/RudderJsonResponse.scala @@ -188,7 +188,7 @@ object RudderJsonResponse { // Internal error with a specific schema def internalError[A](id: Option[String], schema: ResponseSchema, obj: A, errorMsg: Option[String])(implicit prettify: Boolean, - encoder: JsonEncoder[A] + encoder: JsonEncoder[A] ): LiftJsonResponse[? <: JsonRudderApiResponse[?]] = { schema.dataContainer match { case Some(key) => diff --git a/webapp/sources/rudder/rudder-web/src/main/scala/com/normation/rudder/web/services/DisplayNode.scala b/webapp/sources/rudder/rudder-web/src/main/scala/com/normation/rudder/web/services/DisplayNode.scala index ce085ddbf46..8a851c8f0a6 100644 --- a/webapp/sources/rudder/rudder-web/src/main/scala/com/normation/rudder/web/services/DisplayNode.scala +++ b/webapp/sources/rudder/rudder-web/src/main/scala/com/normation/rudder/web/services/DisplayNode.scala @@ -488,7 +488,8 @@ object DisplayNode extends Loggable { |""".stripMargin.replaceAll("\n", " ") } - val nodeStateClasses: String = "node-state " ++ escape(getNodeState(node.rudderSettings.state).toLowerCase).replaceAll(" ", "-") + val nodeStateClasses: String = + "node-state " ++ escape(getNodeState(node.rudderSettings.state).toLowerCase).replaceAll(" ", "-") val nodeStateIcon = { }