patched XML parser to ensure it properly escapes non-html friendly characters prior...
authorjprocter <Jim Procter>
Tue, 19 Apr 2011 13:55:01 +0000 (13:55 +0000)
committerjprocter <Jim Procter>
Tue, 19 Apr 2011 13:55:01 +0000 (13:55 +0000)
src/jalview/ws/EnfinEnvision2OneWay.java

index b5b081d..a11542c 100644 (file)
@@ -33,14 +33,21 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
+import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.Vector;
+import java.util.regex.Pattern;
 
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
@@ -50,10 +57,15 @@ import javax.swing.event.MenuListener;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.apache.axis.utils.StringUtils;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.http.entity.StringEntity;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
+import com.lowagie.text.html.HtmlEncoder;
+
 /**
  * Lightweight runnable to discover dynamic 'one way' group URL services
  * 
@@ -140,6 +152,7 @@ public class EnfinEnvision2OneWay extends DefaultHandler implements
       System.err.println("Adding entry for " + wfname + " " + description);
       if (wfname.toLowerCase().indexOf("funcnet") == -1)
       {
+        description = Pattern.compile("\\s+",Pattern.MULTILINE).matcher(description).replaceAll(" ");
         groupURLdescr.addElement(description);
         groupURLdescr.addElement(description);
         String urlstub=wfname;
@@ -310,6 +323,10 @@ public class EnfinEnvision2OneWay extends DefaultHandler implements
         return;
       }
     }
+    try {
+      descr = HtmlEncoder.encode(descr);
+    } catch (Exception e){};
+    
     boolean seqsorids = (urlgenerator.getGroupURLType() & urlgenerator.SEQUENCEIDS) == 0;
     int i = urlgenerator.getNumberInvolved(urlstub);
     JMenuItem item = new JMenuItem(label);