From 721b6f173257ff1849af70059b869dedccdbd163 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 3 Mar 2026 11:14:55 +0100 Subject: [PATCH] fixing incident #31057 --- .settings/org.eclipse.wst.common.component | 40 ++++++++++++++----- CHANGELOG.md | 4 ++ pom.xml | 2 +- .../CatalogueStaticConfigurations.java | 10 ++++- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 477260f..4755aa2 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + @@ -84,8 +84,12 @@ - - + + + + + + @@ -171,7 +175,9 @@ - + + + @@ -257,7 +263,9 @@ - + + + @@ -343,7 +351,9 @@ - + + + @@ -429,8 +439,12 @@ + + - + + + @@ -516,14 +530,18 @@ - + + + - + + + @@ -609,7 +627,9 @@ - + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ba0495..1ac404d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.10.3-SNAPSHOT] + +- Fixed Incident [#31057] + ## [v2.10.2] - Migrated to Shlink service [#30388] diff --git a/pom.xml b/pom.xml index 1622e39..ed4732d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.data.transfer uri-resolver - 2.10.2 + 2.10.3-SNAPSHOT war The URI Resolver is an HTTP URI resolver implemented as a REST service which gives access trough HTTP to different gcube Resolvers and diff --git a/src/main/java/org/gcube/datatransfer/resolver/catalogue/resource/CatalogueStaticConfigurations.java b/src/main/java/org/gcube/datatransfer/resolver/catalogue/resource/CatalogueStaticConfigurations.java index 32da00a..9c3f708 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/catalogue/resource/CatalogueStaticConfigurations.java +++ b/src/main/java/org/gcube/datatransfer/resolver/catalogue/resource/CatalogueStaticConfigurations.java @@ -79,7 +79,8 @@ public class CatalogueStaticConfigurations{ * @param privateCKANCatalogueURL the private CKAN catalogue URL * @return the catalogue name * - * e.g. Returns "-bb" for "ckan-bb" + * e.g. Returns "-bb" for "ckan-bb" if is a subdomain of "d4science", + * but returns null if the URL is not in the expected format. */ private String extractCatalogueName(String privateCKANCatalogueURL) { @@ -93,7 +94,12 @@ public class CatalogueStaticConfigurations{ LOG.trace(prefix+ " found as prefix of: "+privateCKANCatalogueURL); if(toPrivateCKANCatalogueURL.startsWith(prefix)) { toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst(prefix, ""); //removing prefix - String catalogueName = toPrivateCKANCatalogueURL.substring(0,toPrivateCKANCatalogueURL.indexOf(".d4science")); + int d4scienceIndex = toPrivateCKANCatalogueURL.indexOf(".d4science"); + if(d4scienceIndex < 0) { + LOG.warn("Cannot extract catalogue name: '.d4science' not found in URL after removing prefix '{}'. URL was: {}", prefix, privateCKANCatalogueURL); + return null; + } + String catalogueName = toPrivateCKANCatalogueURL.substring(0, d4scienceIndex); LOG.info("Catalogue Name extraction returning value: "+catalogueName); return catalogueName; }