Compare commits

...

3 Commits

4 changed files with 23 additions and 17 deletions

View File

@ -3,6 +3,7 @@
## [v4.1.0-SNAPSHOT] ## [v4.1.0-SNAPSHOT]
* compatible with s3 storage backend * compatible with s3 storage backend
* remove retry mechanism to exist method * remove retry mechanism to exist method
* add try/catch on exist method #24215
## [v3.0.0] 2021-09-10 ## [v3.0.0] 2021-09-10
* fix #22164 * fix #22164

17
pom.xml
View File

@ -9,9 +9,9 @@
<groupId>org.gcube.contentmanagement</groupId> <groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId> <artifactId>storage-manager-core</artifactId>
<version>4.1.0-SNAPSHOT</version> <version>4.1.0-SNAPSHOT</version>
<!-- <properties> --> <properties>
<!-- <distroDirectory>${project.basedir}/distro</distroDirectory> --> <java_version>1.8</java_version>
<!-- </properties> --> </properties>
<scm> <scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection> <connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection> <developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
@ -53,10 +53,11 @@
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.8</version> <version>1.8</version>
</dependency> </dependency>
<!-- <dependency> --> <dependency>
<!-- <groupId>org.gcube.contentmanagement</groupId> --> <groupId>org.slf4j</groupId>
<!-- <artifactId>storage-manager-s3-plugin</artifactId> --> <artifactId>slf4j-simple</artifactId>
<!-- <version>1.0.0-SNAPSHOT</version> --> <version>1.7.32</version>
<!-- </dependency> --> <scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -36,9 +36,8 @@ public class Exist extends Operation{
isPresent = tm.exist(bucket); isPresent = tm.exist(bucket);
} catch (Exception e) { } catch (Exception e) {
tm.close(); tm.close();
throw new RemoteBackendException(" Error in Exist operation ", e.getCause()); } logger.warn(" Error in Exist operation ", e.getCause());
if (logger.isDebugEnabled()) { isPresent=false;
logger.debug(" PATH " + bucket);
} }
return isPresent+""; return isPresent+"";
} }

View File

@ -314,13 +314,18 @@ public class MongoOperationManager extends TransportManager{
@Override @Override
public boolean exist(String remotePath){ public boolean exist(String remotePath){
boolean isPresent=false; boolean isPresent=false;
if(logger.isDebugEnabled()) try{
logger.debug("MongoDB - check if file exist: "+remotePath); if(logger.isDebugEnabled())
GridFSDBFile f = mongoPrimaryInstance.retrieveRemoteDescriptor(remotePath, null, false); logger.debug("MongoDB - check if file exist: "+remotePath);
if(f!=null){ GridFSDBFile f = mongoPrimaryInstance.retrieveRemoteDescriptor(remotePath, null, false);
isPresent=true; if(f!=null){
isPresent=true;
}
close();
}catch(Exception e){
logger.warn("problem during the retrieve of the following id/path: "+remotePath+" "+e.getMessage());
isPresent=false;
} }
close();
return isPresent; return isPresent;
} }