Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 43   Methods: 3
NCLOC: 29   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UrlPropertiesLoader.java - 100% 100% 100%
coverage
 1    package net.sf.crispy.properties;
 2   
 3    import java.io.InputStream;
 4    import java.net.MalformedURLException;
 5    import java.net.URL;
 6    import java.util.Properties;
 7   
 8    import net.sf.crispy.PropertiesLoader;
 9   
 10    /**
 11    * Load poperty file from a url. Example: <code>file://c:/temp/example.properties</code>.
 12    *
 13    * @author Linke
 14    *
 15    */
 16    public class UrlPropertiesLoader implements PropertiesLoader {
 17   
 18    private URL url = null;
 19   
 20  2 public UrlPropertiesLoader(URL pvUrl) {
 21  2 url = pvUrl;
 22    }
 23   
 24  2 public UrlPropertiesLoader(String pvUrl) {
 25  2 try {
 26  2 url = new URL(pvUrl);
 27    } catch (MalformedURLException e) {
 28  1 throw new PropertiesLoadException("Error by create URL with file: " + pvUrl, e);
 29    }
 30    }
 31   
 32  4 public Properties load() {
 33  4 Properties lvProperties = new Properties();
 34  4 try {
 35  4 InputStream lvInputStream = url.openStream();
 36  3 lvProperties.load(lvInputStream);
 37    } catch (Exception e) {
 38  1 throw new PropertiesLoadException("Error in load-method:", e);
 39    }
 40  3 return lvProperties;
 41    }
 42   
 43    }