X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.osgi%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fosgi%2Finternal%2FBundleModuleSource.java;h=87b78d6ebf44434c61a252baf8fc339886bc9d1f;hp=fc9799de706d6625e401d47dd3320aa7a900cc91;hb=e18cdb01663e3ebdae25e66bf158348bbf823a07;hpb=7402926f3949dbb38e9f8f45e864ba4dd65b59b9 diff --git a/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java b/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java index fc9799de7..87b78d6eb 100644 --- a/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java +++ b/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java @@ -1,5 +1,6 @@ package org.simantics.scl.osgi.internal; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -19,11 +20,15 @@ import org.simantics.scl.compiler.module.ImportDeclaration; import org.simantics.scl.compiler.module.repository.UpdateListener; import org.simantics.scl.compiler.source.EncodedTextualModuleSource; import org.simantics.scl.compiler.types.Type; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.set.hash.THashSet; public class BundleModuleSource extends EncodedTextualModuleSource implements UpdateListener.Observable { + private static final Logger LOGGER = LoggerFactory.getLogger(BundleModuleSource.class); + public static final ImportDeclaration[] DEFAULT_IMPORTS = new ImportDeclaration[] { new ImportDeclaration("Builtin", ""), new ImportDeclaration("StandardLibrary", "") @@ -75,13 +80,13 @@ public class BundleModuleSource extends EncodedTextualModuleSource implements Up } return digest.digest(); } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); + LOGGER.error("No SHA1 algorithm available", e); return new byte[0]; } finally { stream.close(); } } catch(IOException e) { - e.printStackTrace(); + LOGGER.error("Could not compute digest for {}", this); return new byte[0]; } } @@ -151,10 +156,11 @@ public class BundleModuleSource extends EncodedTextualModuleSource implements Up return false; return Files.exists(path); } catch (IOException e) { + LOGGER.debug("Could not check if {} is updateable", this, e); return false; } } - + @Override public void update(String newSourceText) { try { @@ -163,7 +169,7 @@ public class BundleModuleSource extends EncodedTextualModuleSource implements Up return; Files.write(path, newSourceText.getBytes(Charset.forName("UTF-8"))); } catch(IOException e) { - e.printStackTrace(); + LOGGER.error("Could not update {} with {}", this, newSourceText, e); } checkUpdates(); }