package com.allflex.api;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

public enum Config {
    FlexOrderXSD,
    FlexOrderStatusXSD,
    FlexSpecXSD;
    
    String get(){
        try{
            Properties p = getProperties();
            switch(this){
                case FlexOrderXSD:
                    return (String)p.get("FlexOrderXSD");
                case FlexOrderStatusXSD:
                    return (String)p.get("FlexOrderStatusXSD");
                case FlexSpecXSD:
                    return (String)p.get("FlexSpecXSD");
            }
        } catch (IOException ex) {  //IO or NullPointer exceptions possible in block above
            Logger.getLogger(Common.class.getName()).log(Level.SEVERE, null, ex);
            System.exit(1);
        }
        return null;
    }
    
    private static Properties getProperties() throws IOException {
        URL configFile = Config.class.getClass().getResource("/Configuration.config");;
        InputStream configFileStream = configFile.openStream();
        Properties p = new Properties();
        p.load(configFileStream);
        configFileStream.close();
        
        return p;
    }
}

@@ -1076,16 +1076,37 @@
 onfig%22);
+%0A        Properties p
 ;%0A      
@@ -1107,16 +1107,21 @@
         
+try (
 InputStr
@@ -1166,17 +1166,19 @@
 Stream()
-;
+) %7B
 %0A       
@@ -1174,34 +1174,27 @@
 ) %7B%0A        
-Properties
+   
  p = new Pro
@@ -1196,32 +1196,36 @@
 w Properties();%0A
+    
         p.load(c
@@ -1254,42 +1254,9 @@
     
-configFileStream.close();%0A        
+%7D
 %0A   

clean up