public static boolean repositoryDescriptionFileExists ( RestRepositoryConnectionProxy proxy ) { boolean exists = false ; try { URL propertiesFileURL = getPropertiesFileLocation ( ) ; // Are we accessing the properties file (from DHE) using a proxy ? if ( proxy != null ) { if ( proxy . isHTTPorHTTPS ( ) ) { Proxy javaNetProxy = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( proxy . getProxyURL ( ) . getHost ( ) , proxy . getProxyURL ( ) . getPort ( ) ) ) ; URLConnection connection = propertiesFileURL . openConnection ( javaNetProxy ) ; InputStream is = connection . getInputStream ( ) ; exists = true ; is . close ( ) ; if ( connection instanceof HttpURLConnection ) { ( ( HttpURLConnection ) connection ) . disconnect ( ) ; } } else { // The proxy is not an HTTP or HTTPS proxy we do not support this UnsupportedOperationException ue = new UnsupportedOperationException ( "Non-HTTP proxy not supported" ) ; throw new IOException ( ue ) ; } } else { // not using a proxy InputStream is = propertiesFileURL . openStream ( ) ; exists = true ; is . close ( ) ; } } catch ( MalformedURLException e ) { // ignore } catch ( IOException e ) { // ignore } return exists ; }
Tests if the repository description properties file exists as defined by the location override system property or at the default location