Skip to main content
Mistake caught by @EugeneG.Ustimenko (thanks!)
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

There isn't any useful state in the PropertyFileLoader, nor will there be any subclass of PropertyFileLoader that will have state. I think that all you need is a static method (basically your second version, but not swallowing the exception):

public class PropertyFileLoader throws IOException {
    public static Properties load(String filename) throws IOException {
        …
    }
}

There isn't any useful state in the PropertyFileLoader, nor will there be any subclass of PropertyFileLoader that will have state. I think that all you need is a static method (basically your second version, but not swallowing the exception):

public class PropertyFileLoader throws IOException {
    public static Properties load(String filename) {
        …
    }
}

There isn't any useful state in the PropertyFileLoader, nor will there be any subclass of PropertyFileLoader that will have state. I think that all you need is a static method (basically your second version, but not swallowing the exception):

public class PropertyFileLoader {
    public static Properties load(String filename) throws IOException {
        …
    }
}
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

There isn't any useful state in the PropertyFileLoader, nor will there be any subclass of PropertyFileLoader that will have state. I think that all you need is a static method (basically your second version, but not swallowing the exception):

public class PropertyFileLoader throws IOException {
    public static Properties load(String filename) {
        …
    }
}