private void checkHelpSetURL( URL hsURL, ClassLoader globalClassLoader, ClassLoader moduleClassLoader, Map<String, URLClassLoader> classLoaderMap, String cnb) { HelpSet hs = null; try { hs = new HelpSet(moduleClassLoader, hsURL); } catch (HelpSetException ex) { throw new BuildException("Failed to parse " + hsURL + ": " + ex, ex, getLocation()); } javax.help.Map map = hs.getCombinedMap(); Enumeration<?> e = map.getAllIDs(); Set<URI> okurls = new HashSet<URI>(1000); Set<URI> badurls = new HashSet<URI>(1000); Set<URI> cleanurls = new HashSet<URI>(1000); while (e.hasMoreElements()) { javax.help.Map.ID id = (javax.help.Map.ID) e.nextElement(); URL u = null; try { u = id.getURL(); } catch (MalformedURLException ex) { log("id:" + id, Project.MSG_WARN); ex.printStackTrace(); } if (u == null) { throw new BuildException("Bogus map ID: " + id.id + " in: " + cnb); } log("Checking ID " + id.id, Project.MSG_VERBOSE); try { // System.out.println("CALL OF CheckLinks.scan"); List<String> errors = new ArrayList<String>(); CheckLinks.scan( this, globalClassLoader, classLoaderMap, id.id, "", new URI(u.toExternalForm()), okurls, badurls, cleanurls, false, false, false, 2, Collections.<Mapper>emptyList(), errors); for (String error : errors) { log(error, Project.MSG_WARN); } // System.out.println("RETURN OF CheckLinks.scan"); } catch (URISyntaxException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } } }
/** * Try to find an id in a toolbox * * @param tbxName the toolbox's name * @param id the id to find * @return the URL corresponding to the id */ public URL getURLFromID(String tbxName, String id) { if (tbxName == null) { return getURLFromID(id); } URL url = null; try { for (HelpSet hs : helpSets) { if (hs.getHelpSetURL().toString().replaceAll("\\\\", "/").contains("/" + tbxName + "/")) { javax.help.Map map = hs.getLocalMap(); if (map.isValidID(id, hs)) { url = map.getURLFromID(javax.help.Map.ID.create(id, hs)); if (url != null) { return url; } } } } url = new URL( helpSets .get(0) .getHelpSetURL() .toString() .replace("jhelpset.hs", "ScilabErrorPage.html")); } catch (MalformedURLException ex) { } return url; }