From 2d06ee4cf066455470cb52dbbe3fcd935a0cb920 Mon Sep 17 00:00:00 2001 From: Sebastian Niklasch Date: Thu, 28 Jan 2016 11:59:46 +0100 Subject: [PATCH] Fixed a bug occuring when the configuration file of a feature is located in a subfolder. --- .../feature/persistence/sql/SqlFeatureStoreBuilder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/SqlFeatureStoreBuilder.java b/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/SqlFeatureStoreBuilder.java index 80859aced0..381f7a0438 100644 --- a/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/SqlFeatureStoreBuilder.java +++ b/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/SqlFeatureStoreBuilder.java @@ -84,7 +84,13 @@ public FeatureStore build() { ConnectionProvider conn = workspace.getResource( ConnectionProviderProvider.class, config.getJDBCConnId().getValue() ); checkConnection( conn ); - File file = metadata.getLocation().resolveToFile( metadata.getIdentifier().getId() + ".xml" ); + String filename = metadata.getIdentifier().getId() + ".xml"; + int pos; + if ( ( pos = filename.lastIndexOf( "/" ) ) > -1 ) { + // TRICKY if file is in a subfolder, this folder is part of the identifier AND the file-location: + filename = filename.substring( pos + 1 ); + } + File file = metadata.getLocation().resolveToFile( filename ); SQLFeatureStore fs = null; try { // TODO rewrite needed to properly resolve files using resource location