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