private static URL computeSharedConfigurationLocation() { String property = FrameworkProperties.getProperty(PROP_SHARED_CONFIG_AREA); if (property == null) return null; try { URL sharedConfigurationURL = LocationHelper.buildURL(property, true); if (sharedConfigurationURL == null) return null; if (sharedConfigurationURL.getPath().startsWith("/")) // $NON-NLS-1$ // absolute return sharedConfigurationURL; URL installURL = installLocation.getURL(); if (!sharedConfigurationURL.getProtocol().equals(installURL.getProtocol())) // different protocol return sharedConfigurationURL; sharedConfigurationURL = new URL(installURL, sharedConfigurationURL.getPath()); FrameworkProperties.setProperty( PROP_SHARED_CONFIG_AREA, sharedConfigurationURL.toExternalForm()); } catch (MalformedURLException e) { // do nothing here since it is basically impossible to get a bogus url } return null; }
/** * Builds a URL with the given specification * * @param spec the URL specification * @param trailingSlash flag to indicate a trailing slash on the spec * @return a URL */ public static URL buildURL(String spec, boolean trailingSlash) { return LocationHelper.buildURL(spec, trailingSlash); }
private static URL computeInstallConfigurationLocation() { String property = FrameworkProperties.getProperty(PROP_INSTALL_AREA); if (property != null) return LocationHelper.buildURL(property, true); return null; }