// Path: eid-viewer-gui/src/main/java/be/fedict/eidviewer/gui/helper/ProxyUtils.java
// public class ProxyUtils
// {
//     private static final Logger logger              = Logger.getLogger(ProxyUtils.class.getName());
//     private static final String USE_SYSTEM_PROXIES  = "java.net.useSystemProxies";
//     private static final String PROXY_TEST_URL      = "http://trust-ws.services.belgium.be/eid-trust-service-ws/xkms2";
//     private static final Proxy  systemProxy         =determineSystemProxy(PROXY_TEST_URL);
//     
//     public static Proxy getSystemProxy()
//     {
//         if(systemProxy==null)
//             return Proxy.NO_PROXY;
//         return systemProxy;
//     }
// 
//     public static String getHostName(Proxy proxy)
//     {
//         InetSocketAddress address=(InetSocketAddress) proxy.address();
//         return address.getHostName();
//     }
//     
//     public static int getPort(Proxy proxy)
//     {
//         InetSocketAddress address=(InetSocketAddress) proxy.address();
//         return address.getPort();
//     }
//     
//     private static Proxy determineSystemProxy(String forURL)
//     {
//         Proxy newProxy=Proxy.NO_PROXY;
//         
//         logger.log(Level.FINEST, "Determining System Proxy For[{0}]", forURL);
//         
//         final String savedProxySetting = System.getProperty(USE_SYSTEM_PROXIES);
//         logger.finest("Saved Original useSystemProxies Setting");
// 
//         try
//         {
//             logger.finest("Temporarily Enabling useSystemProxies");
//             System.setProperty(USE_SYSTEM_PROXIES,"true");
//             logger.log(Level.FINEST, "using default ProxySelector on [{0}]", forURL);
//             List<Proxy> availableProxies=ProxySelector.getDefault().select(new java.net.URI(PROXY_TEST_URL));
//             logger.log(Level.FINEST, "Default ProxySelector returned [{0}] Proxy Objects", availableProxies.size());
//             
//             logger.finest("Finding HTTP Proxies");
//             for(Proxy proxy : availableProxies)             // try HTTP proxies
//             {
//                 logger.log(Level.FINEST, "Checking Out [{0}]", proxy.toString());
//                 if(proxy.type().equals(Proxy.Type.HTTP))
//                 {
//                     logger.log(Level.FINEST, "Found HTTP Connection [{0}]", proxy.toString());
//                     newProxy=proxy;
//                     break;
//                 }
//             }
//    
//         }
//         catch(Exception e)
//         {
//             logger.log(Level.WARNING,"Cannot Determine System HTTP Proxy", e);
//         }
//         finally
//         {
//             if(savedProxySetting!=null)
//             {
//                 logger.finest("Restoring Enabling useSystemProxies");
//                 System.setProperty(USE_SYSTEM_PROXIES, savedProxySetting);
//             }
//         }
// 
//         return newProxy;
//     }
// }


import be.fedict.eidviewer.gui.helper.ProxyUtils;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
	    return getDefaultLocale();

	String language = prefs.get(LOCALE_LANGUAGE, DEFAULT_LOCALE_LANGUAGE);

	if (language == null)
	    return getDefaultLocale();

	if (isLanguageBelgian(language))
	    return new Locale(language, "BE");
	else
	    return Locale.US;
    }

    public static String getFullVersion() {
	return "eID Viewer " + getVersion();
    }

    public static String getVersion() {
	ResourceBundle bundle = ResourceBundle
		.getBundle("be/fedict/eidviewer/gui/resources/Version");
	return bundle.getString("version");
    }

    public static Proxy getProxy() {
	validateProxy();
	switch (getProxyType()) {
	case PROXY_SPECIFIC:
	    return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(
		    getSpecificProxyHost(), getSpecificProxyPort()));
	case PROXY_SYSTEM:
// Path: eid-viewer-gui/src/main/java/be/fedict/eidviewer/gui/helper/ProxyUtils.java
// public class ProxyUtils
// {
//     private static final Logger logger              = Logger.getLogger(ProxyUtils.class.getName());
//     private static final String USE_SYSTEM_PROXIES  = "java.net.useSystemProxies";
//     private static final String PROXY_TEST_URL      = "http://trust-ws.services.belgium.be/eid-trust-service-ws/xkms2";
//     private static final Proxy  systemProxy         =determineSystemProxy(PROXY_TEST_URL);
//     
//     public static Proxy getSystemProxy()
//     {
//         if(systemProxy==null)
//             return Proxy.NO_PROXY;
//         return systemProxy;
//     }
// 
//     public static String getHostName(Proxy proxy)
//     {
//         InetSocketAddress address=(InetSocketAddress) proxy.address();
//         return address.getHostName();
//     }
//     
//     public static int getPort(Proxy proxy)
//     {
//         InetSocketAddress address=(InetSocketAddress) proxy.address();
//         return address.getPort();
//     }
//     
//     private static Proxy determineSystemProxy(String forURL)
//     {
//         Proxy newProxy=Proxy.NO_PROXY;
//         
//         logger.log(Level.FINEST, "Determining System Proxy For[{0}]", forURL);
//         
//         final String savedProxySetting = System.getProperty(USE_SYSTEM_PROXIES);
//         logger.finest("Saved Original useSystemProxies Setting");
// 
//         try
//         {
//             logger.finest("Temporarily Enabling useSystemProxies");
//             System.setProperty(USE_SYSTEM_PROXIES,"true");
//             logger.log(Level.FINEST, "using default ProxySelector on [{0}]", forURL);
//             List<Proxy> availableProxies=ProxySelector.getDefault().select(new java.net.URI(PROXY_TEST_URL));
//             logger.log(Level.FINEST, "Default ProxySelector returned [{0}] Proxy Objects", availableProxies.size());
//             
//             logger.finest("Finding HTTP Proxies");
//             for(Proxy proxy : availableProxies)             // try HTTP proxies
//             {
//                 logger.log(Level.FINEST, "Checking Out [{0}]", proxy.toString());
//                 if(proxy.type().equals(Proxy.Type.HTTP))
//                 {
//                     logger.log(Level.FINEST, "Found HTTP Connection [{0}]", proxy.toString());
//                     newProxy=proxy;
//                     break;
//                 }
//             }
//    
//         }
//         catch(Exception e)
//         {
//             logger.log(Level.WARNING,"Cannot Determine System HTTP Proxy", e);
//         }
//         finally
//         {
//             if(savedProxySetting!=null)
//             {
//                 logger.finest("Restoring Enabling useSystemProxies");
//                 System.setProperty(USE_SYSTEM_PROXIES, savedProxySetting);
//             }
//         }
// 
//         return newProxy;
//     }
// }


// Path: eid-viewer-gui/src/main/java/be/fedict/eidviewer/gui/ViewerPrefs.java
import be.fedict.eidviewer.gui.helper.ProxyUtils;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;

	    return getDefaultLocale();

	String language = prefs.get(LOCALE_LANGUAGE, DEFAULT_LOCALE_LANGUAGE);

	if (language == null)
	    return getDefaultLocale();

	if (isLanguageBelgian(language))
	    return new Locale(language, "BE");
	else
	    return Locale.US;
    }

    public static String getFullVersion() {
	return "eID Viewer " + getVersion();
    }

    public static String getVersion() {
	ResourceBundle bundle = ResourceBundle
		.getBundle("be/fedict/eidviewer/gui/resources/Version");
	return bundle.getString("version");
    }

    public static Proxy getProxy() {
	validateProxy();
	switch (getProxyType()) {
	case PROXY_SPECIFIC:
	    return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(
		    getSpecificProxyHost(), getSpecificProxyPort()));
	case PROXY_SYSTEM:
	    return ProxyUtils.getSystemProxy();