From ff65f245e3cee368def017d16997d6dad6be54b6 Mon Sep 17 00:00:00 2001 From: "nikita.smirnov" Date: Thu, 26 Sep 2024 12:06:44 +0400 Subject: [PATCH] Provided windows compatibility for ExactproMetaInf --- README.md | 6 +++++- gradle.properties | 17 +---------------- .../common/schema/factory/ExactproMetaInf.kt | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 413fbadba..d2a172c11 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# th2 common library (Java) (5.14.0) +# th2 common library (Java) (5.14.1) ## Usage @@ -511,6 +511,10 @@ dependencies { ## Release notes +### 5.14.1-dev + ++ Provided windows compatibility + ### 5.14.0-dev + Separate connections for publisher and consumer (allows to consume while publishing is blocked by RabbitMQ) diff --git a/gradle.properties b/gradle.properties index f8a2b4afb..8c4df134d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,4 @@ -# -# Copyright 2022-2024 Exactpro (Exactpro Systems Limited) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -release_version=5.14.0 +release_version=5.14.1 kotlin_version=1.8.22 description='th2 common library (Java)' vcs_url=https://github.com/th2-net/th2-common-j diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt b/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt index 0295e3a23..53eefddfe 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/factory/ExactproMetaInf.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 Exactpro (Exactpro Systems Limited) + * Copyright 2023-2024 Exactpro (Exactpro Systems Limited) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,16 @@ internal class ExactproMetaInf( private val title: String, private val version: String ) { - private val jarPath = Path.of(url.path).parent.parent + private val jarPath: Path = url.toURI().run { + // the code below are added to provide windows compatibility + when (scheme) { + "file" -> Path.of(this) + "jar" -> Path.of( + schemeSpecificPart.substringBefore("!").removePrefix("file:") + ) + else -> error("The '$scheme' schema of '$this' URI can't be handled") + }.parent.parent + } private var gitEnriched = false private var gitHash = "" @@ -106,7 +115,7 @@ internal class ExactproMetaInf( attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION) ) } - } catch (e: IOException) { + } catch (e: Exception) { K_LOGGER.warn(e) { "Manifest '$manifestUrl' loading failure" } return null }