]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/uwobo/src/it/unibo/cs/helm/uwobo/Server.java
Commit of Ferruccio changes:
[helm.git] / helm / uwobo / src / it / unibo / cs / helm / uwobo / Server.java
index da11a070cefb14f078ad45f9fe54f96b14822243..cd2f2fa30a2a05251d599ae687bab383a7be623c 100644 (file)
@@ -152,7 +152,8 @@ public class Server {
                hashMap.put(key, style);
        }
 
-       public void removeAll() throws TransformerConfigurationException, SAXException, IOException {
+       public void removeAll() 
+        {
                String key;
                Style style;
                Iterator i = hashMap.keySet().iterator();
@@ -212,9 +213,9 @@ public class Server {
                        return applyStylesheet(style.stylesheet, keys[idx].params, applyRec(keys, idx - 1, saxOutput));
                }
        }
-
+//FileNotFoundException
        public void apply(String inFile, OutputStream outputStream, Key[] keys, Properties userProperties)
-       throws FileNotFoundException, IOException, TransformerConfigurationException, SAXException, Exception
+       throws IOException, TransformerConfigurationException, SAXException, Exception
        {
 /*             File outFile = new File(outFilename);
                if (outFile.exists())
@@ -273,11 +274,14 @@ public class Server {
 
        public void reload(String key) throws TransformerConfigurationException, SAXException, IOException {
                Style style = (Style)hashMap.get(key);
-
-               log("reloading \"" + key + "\"... ");
-               style.stylesheet = compileStylesheet(style.fileName);
-               style.lastModified = new File(style.fileName).lastModified();
-               log("done!");
+                if (style != null) {
+                       log("reloading \"" + key + "\"... ");
+                       style.stylesheet = compileStylesheet(style.fileName);
+                       style.lastModified = new File(style.fileName).lastModified();
+                       log("done!");
+               } else {
+                       log("error, stylesheet \"" + key + "\" not loaded");
+               }
        }
 
        public void updateAll() throws TransformerConfigurationException, SAXException, IOException {
@@ -288,14 +292,18 @@ public class Server {
 
        public void update(String key) throws TransformerConfigurationException, SAXException, IOException {
                Style style = (Style)hashMap.get(key);
-
-               log("updating \"" + key + "\"... ");
-               File styleFile = new File(style.fileName);
-               if (styleFile.lastModified() > style.lastModified) {
-                       style.stylesheet = compileStylesheet(style.fileName);
-                       style.lastModified = styleFile.lastModified();
-                       log("done!");
-               } else
-                       log("\"" + key + "\" is up to date");
+                if (style != null) {
+                       log("updating \"" + key + "\"... ");
+                       File styleFile = new File(style.fileName);
+                       if (styleFile.lastModified() > style.lastModified) {
+                               style.stylesheet = compileStylesheet(style.fileName);
+                               style.lastModified = styleFile.lastModified();
+                               log("done!");
+                       } else {
+                               log("\"" + key + "\" is up to date");
+                       }
+               } else {
+                       log("error, stylesheet \"" + key + "\" not loaded");
+               }
        }
 }