}  catch (Exception x){
} catch (Exception x){ System.err.println(x.getMessage()); throw new IOException(labels.getString("failed")); } } } else { throw new IOException(labels.getString("nocommand")); } } else {       new URL(url);     StringBuffer sb = new StringBuffer(url.length()); for (int i=0; i<url.length(); i++){ char c = url.charAt(i); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' || c == ':' || c == '&' || c == '@' || c == '/' || c == '?' || c == '%' || c =='+' || c == '=' || c == '#' || c == '-'){      sb.append(c); } else { c = (char)(c & 0xFF); if (c < 0x10){ sb.append("%0" + Integer.toHexString(c)); } else { sb.append("%" + Integer.toHexString(c)); } } } String[] messageArray = new String[1]; messageArray[0] = sb.toString(); String command = null; boolean found = false;  try { for (int i=0; i<exec.length && !found; i++){ try {  command = MessageFormat.format(exec[i], messageArray);  Vector argsVector = new Vector(); BrowserCommandLexer lex = new BrowserCommandLexer(new StringReader(command)); String t; while ((t = lex.getNextToken()) != null) { argsVector.add(t); } String[] args = new String[argsVector.size()]; args = (String[])argsVector.toArray(args);        if (args[0].equals("rundll32") && args[1].equals("url.dll,FileProtocolHandler") && args[2].startsWith("file:/")){ if (args[2].charAt(6) != '/'){ args[2] = "file: } if (args[2].charAt(7) != '/'){ args[2] = "file: } File shortcut = File.createTempFile("OpenInBrowser", ".url"); shortcut = shortcut.getCanonicalFile(); shortcut.deleteOnExit(); PrintWriter out = new PrintWriter(new FileWriter(shortcut)); out.println("[InternetShortcut]"); out.println("URL=" + args[2]); out.close(); args[2] = shortcut.getCanonicalPath(); }  Process p = Runtime.getRuntime().exec(args);       for (int j=0; j<2; j++){ try{ Thread.currentThread().sleep(1000); } catch (InterruptedException inte){ } } if (p.exitValue() == 0){     found = true; } } catch (IOException x){  System.err.println(labels.getString("warning") + " " + x.getMessage()); } } if (!found){  throw new IOException(labels.getString("failed")); } } catch (IllegalThreadStateException e){   } } }
	 public static void displayURL(String url) throws IOException {		if (exec == nu ll || exec.length == 0){			if (System .getProperty("os.name").startsWith("Mac")){				boolea n success = false;			try {				Class  nSWorkspace;					if  (new File("/System/Library/Java/com/apple/cocoa/application/NSWorkspace.class").exists()){						 // Mac OS X has NSWorkspace, but it is not in the classpath, add it.						 ClassLoader classLoader = new URLClassLoader(new URL[]{new File("/System/Library/Java").toURL()});						 nSWorkspace = Class.forName("com.apple.cocoa.application.NSWorkspace", true, classLoader);					}  else {						 nSWorkspace = Class.forName("com.apple.cocoa.application.NSWorkspace");					}					Me thod sharedWorkspace = nSWorkspace.getMethod("sharedWorkspace", new Class[] {});					Ob ject workspace = sharedWorkspace.invoke(null, new Object[] {});					Me thod openURL = nSWorkspace.getMethod("openURL", new Class[] {Class.forName("java.net.URL")});					su ccess = ((Boolean)openURL.invoke(workspace, new Object[] {new java.net.URL(url)})).booleanValue();				//succ ess = com.apple.cocoa.application.NSWorkspace.sharedWorkspace().openURL(new java.net.URL(url));			} catch (E xception x) {}				if (!s uccess){					tr y {						 Class mrjFileUtils = Class.forName("com.apple.mrj.MRJFileUtils");						 Method openURL = mrjFileUtils.getMethod("openURL", new Class[] {Class.forName("java.lang.String")});						 openURL.invoke(null, new Object[] {url});						 //com.apple.mrj.MRJFileUtils.openURL(url);					}  catch (Exception x){