Fixing log

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158785 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-11-23 11:40:35 +00:00
parent 96b98199e8
commit 4f42387f85
1 changed files with 25 additions and 3 deletions

View File

@ -440,8 +440,10 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
return true;
} catch (ResourceRegistryException e) {
logger.error("Unable to find {} with UUID {}", accessType.getName(), uuid);
throw e;
} catch (Exception e) {
logger.error("Unable to find {} with UUID {}", accessType.getName(), uuid, e);
throw new ResourceRegistryException(e);
} finally {
if (orientGraph != null) {
@ -464,11 +466,13 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
return serialize();
} catch (ResourceRegistryException e) {
logger.error("Unable to create {}", accessType.getName());
if (orientGraph != null) {
orientGraph.rollback();
}
throw e;
} catch (Exception e) {
logger.error("Unable to create {}", accessType.getName(), e);
if (orientGraph != null) {
orientGraph.rollback();
}
@ -490,8 +494,10 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
return serialize();
} catch (ResourceRegistryException e) {
logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid);
throw e;
} catch (Exception e) {
logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid, e);
throw new ResourceRegistryException(e);
} finally {
if (orientGraph != null) {
@ -517,11 +523,13 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
// TODO Serialized resource is the old version. This really strange and should be an orient bug
} catch (ResourceRegistryException e) {
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid);
if (orientGraph != null) {
orientGraph.rollback();
}
throw e;
} catch (Exception e) {
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid, e);
if (orientGraph != null) {
orientGraph.rollback();
}
@ -557,7 +565,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
return deleted;
} catch (ResourceRegistryException e) {
logger.error("Unable to delete {} with UUID {}", accessType.getName(), uuid, e);
logger.error("Unable to delete {} with UUID {}", accessType.getName(), uuid);
if (orientGraph != null) {
orientGraph.rollback();
}
@ -575,7 +583,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
}
}
public boolean addToContext() throws ERNotFoundException, ContextException {
public boolean addToContext() throws ERNotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to add {} with UUID {} to actual Context",
accessType.getName(), uuid);
@ -590,6 +598,13 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
accessType.getName(), uuid);
return added;
} catch (ResourceRegistryException e) {
logger.error("Unable to add {} with UUID {} to actual Context",
accessType.getName(), uuid);
if (orientGraph != null) {
orientGraph.rollback();
}
throw e;
} catch (Exception e) {
logger.error("Unable to add {} with UUID {} to actual Context",
accessType.getName(), uuid, e);
@ -604,7 +619,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
}
}
public boolean removeFromContext() throws ERNotFoundException, ContextException {
public boolean removeFromContext() throws ERNotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to remove {} with UUID {} from actual Context",
accessType.getName(), uuid);
@ -620,6 +635,13 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
accessType.getName(), uuid);
return removed;
} catch (ResourceRegistryException e) {
logger.error("Unable to remove {} with UUID {} from actual Context",
accessType.getName(), uuid);
if (orientGraph != null) {
orientGraph.rollback();
}
throw e;
} catch (Exception e) {
logger.error(
"Unable to remove {} with UUID {} from actual Context",