[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Mon Jun 18 20:01:12 UTC 2007


gordonp
Mon Jun 18 16:01:12 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv11771/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyContentPane.java 
Log Message:
Fixed regression on binary file imports, were treated as text due to preformatting condition in previous revision of this file
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentPane.java,1.11,1.12
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2007/06/16 00:24:00	1.11
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2007/06/18 20:01:12	1.12
@@ -216,6 +216,7 @@
 	    String protocol = url.getProtocol();
 	    URLConnection urlCon = url.openConnection();
 
+	    boolean unformatted = false;
 	    // It's XML that needs to be transformed to HTML
 	    if(urlString.lastIndexOf(".xml") == urlString.length()-4 ||
 	       "text/xml".equals(urlCon.getContentType())){
@@ -293,6 +294,7 @@
 		    resultBuffer = null;
 		}
 		else{
+		    unformatted = true;
 		    resultBuffer = new StringBuffer("<html><body><pre>"+
 						    body.replaceAll("&", "&amp;").replaceAll("<","&lt;")+
 						    "</pre></body></html>");
@@ -302,7 +304,7 @@
 	    if(resultBuffer == null){ // only happens if the url is already an HTML doc
 		editorPane.setPage(url);
 	    }
-	    else if(resultBuffer.length() == 0){
+	    else if(resultBuffer.length() == 0 || unformatted){
 		// Attempt to use MobyClient to convert the url's data into a Moby object
 		// (e.g. if the file to load is an image, or a chromatogram) 
 		try{
@@ -324,7 +326,11 @@
 		    logger.error("Failure in loading MOBYfied binary data:\n" + e);
 		}
 		// Shouldn't get here unless either not binary, or the binary data load failed
-		editorPane.setPage(url);
+		if(resultBuffer.length() == 0){
+		    editorPane.setPage(url);
+		} else{
+		    editorPane.setText(resultBuffer.toString());
+		}
 	    }
 	    else{
 		editorPane.setText(resultBuffer.toString());




More information about the MOBY-guts mailing list