< prev index next >

src/java.base/share/classes/sun/net/ftp/FtpClientProvider.java

Print this page




  50 
  51     /**
  52      * Initializes a new instance of this class.
  53      *
  54      * @throws SecurityException if a security manager is installed and it denies
  55      *         {@link RuntimePermission}{@code ("ftpClientProvider")}
  56      */
  57     protected FtpClientProvider() {
  58         SecurityManager sm = System.getSecurityManager();
  59         if (sm != null) {
  60             sm.checkPermission(new RuntimePermission("ftpClientProvider"));
  61         }
  62     }
  63 
  64     private static boolean loadProviderFromProperty() {
  65         String cm = System.getProperty("sun.net.ftpClientProvider");
  66         if (cm == null) {
  67             return false;
  68         }
  69         try {
  70             Class<?> c = Class.forName(cm, true, null);
  71             provider = (FtpClientProvider) c.newInstance();

  72             return true;
  73         } catch (ClassNotFoundException |
  74                  IllegalAccessException |
  75                  InstantiationException |
  76                  SecurityException x) {
  77             throw new ServiceConfigurationError(x.toString());
  78         }
  79     }
  80 
  81     private static boolean loadProviderAsService() {
  82 //        Iterator<FtpClientProvider> i =
  83 //                ServiceLoader.load(FtpClientProvider.class,
  84 //                                   ClassLoader.getSystemClassLoader()).iterator();
  85 //
  86 //        while (i.hasNext()) {
  87 //            try {
  88 //                provider = i.next();
  89 //                return true;
  90 //            } catch (ServiceConfigurationError sce) {
  91 //                if (sce.getCause() instanceof SecurityException) {




  50 
  51     /**
  52      * Initializes a new instance of this class.
  53      *
  54      * @throws SecurityException if a security manager is installed and it denies
  55      *         {@link RuntimePermission}{@code ("ftpClientProvider")}
  56      */
  57     protected FtpClientProvider() {
  58         SecurityManager sm = System.getSecurityManager();
  59         if (sm != null) {
  60             sm.checkPermission(new RuntimePermission("ftpClientProvider"));
  61         }
  62     }
  63 
  64     private static boolean loadProviderFromProperty() {
  65         String cm = System.getProperty("sun.net.ftpClientProvider");
  66         if (cm == null) {
  67             return false;
  68         }
  69         try {
  70             @SuppressWarnings("deprecation")
  71             Object o = Class.forName(cm, true, null).newInstance();
  72             provider = (FtpClientProvider)o;
  73             return true;
  74         } catch (ClassNotFoundException |
  75                  IllegalAccessException |
  76                  InstantiationException |
  77                  SecurityException x) {
  78             throw new ServiceConfigurationError(x.toString());
  79         }
  80     }
  81 
  82     private static boolean loadProviderAsService() {
  83 //        Iterator<FtpClientProvider> i =
  84 //                ServiceLoader.load(FtpClientProvider.class,
  85 //                                   ClassLoader.getSystemClassLoader()).iterator();
  86 //
  87 //        while (i.hasNext()) {
  88 //            try {
  89 //                provider = i.next();
  90 //                return true;
  91 //            } catch (ServiceConfigurationError sce) {
  92 //                if (sce.getCause() instanceof SecurityException) {


< prev index next >