URL url = file.toURL();
URL url = file.toURI().toURL();
	private void loadPlugins() {		// Load all detector plugins.			//If we are running under jaws, just use the loaded plugin	    if (Boolean.getBoolean("findbugs.jaws")) {			URL u = DetectorFactoryCollection.class.getResource("/findbugs.xml");		    File[] plugins = new File[1];		    if (u != null) {		        String path = new File(u.toString()).getParent();		        path = path.substring("jar:file:".length());		        path = path.substring(0, path.length() - 1);		        System.out.println("Jaws uses plugin: " + path);		        plugins[0] = new File(path);		        setPluginList(plugins);		    }		}				if (pluginList == null) {			String homeDir = FindBugs.getHome();			if (homeDir == null)				return;			File pluginDir = new File(homeDir + File.separator + "plugin");			File[] contentList = pluginDir.listFiles();			if (contentList == null) {				System.err.println("Error: The path " + pluginDir.getPath() + " does not seem to be a directory!");				System.err.println("No FindBugs plugins could be loaded");				pluginList = new File[0];				return;			}			ArrayList<File> arr = new ArrayList<File>();			for (int i = 0; i < contentList.length; ++i) {				if (contentList[i].getName().endsWith(".jar")) {					if (FindBugs.DEBUG) System.out.println("Found plugin: " + contentList[i].toString());					arr.add(contentList[i]);				}			}			pluginList = (File[]) arr.toArray(new File[arr.size()]);		}		int numLoaded = 0;		for (int i = 0; i < pluginList.length; ++i) {			File file = pluginList[i];			try {				if (FindBugs.DEBUG) System.out.println("Loading plugin: " + file.toString());				URL url = file.toURL();				PluginLoader pluginLoader = new PluginLoader(url, this.getClass().getClassLoader());				Plugin plugin = pluginLoader.getPlugin();				pluginByIdMap.put(plugin.getPluginId(), plugin);								// Register all of the detectors that this plugin contains				for (Iterator<DetectorFactory> j = plugin.detectorFactoryIterator();						j.hasNext(); ) {					DetectorFactory factory = j.next();					registerDetector(factory);				}				I18N i18n = I18N.instance();				// Register the BugPatterns				for (Iterator<BugPattern> j = plugin.bugPatternIterator(); j.hasNext();){ 					BugPattern bugPattern = j.next();					i18n.registerBugPattern(bugPattern);				}								// Register the BugCodes				for (Iterator<BugCode> j = plugin.bugCodeIterator(); j.hasNext(); ) {					BugCode bugCode = j.next();					i18n.registerBugCode(bugCode);				}				++numLoaded;			} catch (Exception e) {				System.err.println("Warning: could not load plugin " + file.getPath() + ": " + e.toString());				if (FindBugs.DEBUG)					e.printStackTrace();			}		}			//System.out.println("Loaded " + numLoaded + " plugins");	}