X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fscl%2FGraphModuleSourceRepository.java;h=f3f5b917067a887a992b948a52760a3813b13f6e;hb=6b5821ad728bf2f127091cb36d57b87749a6532f;hp=b6d6caefd25c6a93de3eca1990e39fdb62cfbbd6;hpb=346cd36c02aad1e33652a67e03b1508cc58e723f;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java index b6d6caefd..f3f5b9170 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphModuleSourceRepository.java @@ -51,7 +51,7 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { else return Simantics.getAvailableRequestProcessor().syncRequest(request); } catch (DatabaseException e) { - LOGGER.error("Failed to read graph module " + moduleName + ".", e); + LOGGER.error("Failed to read graph module {}.", moduleName, e); return null; } } @@ -96,10 +96,15 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { @Override public void exception(ReadGraph graph, Throwable t) throws DatabaseException { - t.printStackTrace(); + LOGGER.error("Could not listen {}", this, t); if(alreadyExecutedOnce && listener != null) fireUpdate(graph); } + + @Override + public String toString() { + return moduleName + " " + listener + " (" + alreadyExecutedOnce + ") [" + getClass().toString() + "]"; + } }; public static class GraphModuleSource extends StringModuleSource { @@ -121,7 +126,7 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { try { Simantics.getSession().syncRequest(new WriteModuleSource(getModuleName(), newSourceText)); } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("Could not update {} with newSourceText {}", this, newSourceText); } } @@ -185,7 +190,11 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { Collection ontologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE); for (Resource ontology : ontologies) { for(Resource module : ModelingUtils.searchByType(graph, ontology, L0.SCLModule)) - result.add(graph.getURI(module)); + try { + result.add(graph.getURI(module)); + } catch(DatabaseException e) { + LOGGER.error("Failed to find uri for " + module + "."); + } } return result; @@ -193,8 +202,9 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { @Override public void forAllModules(TObjectProcedure procedure) { + THashSet moduleURIs = null; try { - THashSet moduleURIs = Simantics.getAvailableRequestProcessor().syncRequest(new Read>() { + moduleURIs = Simantics.getAvailableRequestProcessor().syncRequest(new Read>() { @Override public THashSet perform(ReadGraph graph) throws DatabaseException { @@ -203,7 +213,7 @@ public enum GraphModuleSourceRepository implements ModuleSourceRepository { }); moduleURIs.forEach(procedure); } catch (DatabaseException e) { - e.printStackTrace(); + LOGGER.error("Could not execute procedure {} for all modules {}", procedure, String.valueOf(moduleURIs), e); } }