Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java	(revision 21575)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java	(revision 21775)
@@ -323,8 +323,9 @@
         	String docContent = docNode.getContent();
         	if(docContent != null) {
-        		docContent = docContent.replaceAll(
-        				"ALIGN=\"JUSTIFY\"", "ALIGN=\"LEFT\"");
+		    	docContent = docContent.replaceAll(
+		    		"ALIGN=\"JUSTIFY\"", "ALIGN=\"LEFT\"");
         	}
-        	this.docContentEditPane.setText(docContent);
+
+		this.docContentEditPane.setText(docContent);
     		this.docContentEditPane.setCaretPosition(0); // set 'cursor' at top
         }
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java	(revision 21575)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraConnection.java	(revision 21775)
@@ -766,6 +766,7 @@
 	
 	/** All "greenstone:*" objects in fedora (be they collections or documents) 
-	 * have a TOC datastream. This method returns the content (XML) of the TOC  
-	 * datastream as is. (Calls default fedora-system 3 dissemination &lt;pid&gt;/TOC.)
+	 * have a TOC datastream, unless they have only 1 section (SECTION1). 
+	 * This method returns the content (XML) of the TOC datastream as is.
+	 * (Calls default fedora-system 3 dissemination &lt;pid&gt;/TOC.)
 	 * @return a String version of the XML in the TOC datastream for the fedora
 	 * object denoted by pid.
@@ -780,9 +781,13 @@
 		throws RemoteException, UnsupportedEncodingException 
 	{
+	    try {
 		MIMETypedStream tocStream = APIA.getDatastreamDissemination(pid, TOC, null);
 			//asOfDateTime = null to get the current version of the dataStream
-		
 		// need to set the charset encoding to UTF8
 		return new String(tocStream.getStream(), UTF8);
+	    } catch(RemoteException re) {
+		// if TOC does not exist, then it means there is only 1 section, dsID: SECTION1
+		return new String("<Section id=\"1\"></Section>".getBytes(), UTF8); //set charset
+	    }		
 	}
 	
@@ -1317,6 +1322,7 @@
 		// If sectionNumber=1, then the top-level element/document element
 		// of the TOC XML is requested, so return the TOC as is.
-		if(sectionNumber.equals("1"))
+		if(sectionNumber.equals("1")) {
 			return docEl;
+		}
 		
 		// Get all <Section> elements and find the
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java	(revision 21575)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3Fedora/org/greenstone/fedora/services/FedoraGS3Connection.java	(revision 21775)
@@ -1035,5 +1035,5 @@
 				// set the text content to what was retrieved
 				Element nodeContent = doc.createElement(GSXML.NODE_CONTENT_ELEM);
-				Text textNode = doc.createTextNode(sectionContent);
+				Text textNode = doc.createTextNode(sectionContent.trim());
 				
 				nodeContent.appendChild(textNode);
@@ -1301,4 +1301,7 @@
 	 * serviceNames: DocumentContent/Metadata/StructureRetrieve, ClassifierBrowse,
 	 * ClassifierBrowseMetadataRetrieve.   
+	 * All collections in this Digital Library (Fedora Repository) share 
+	 * the same services, so this method returns the same as 
+	 * describeService(serviceName).
 	 * @param collectionName - the name of the collection whose services are to
 	 * be described. It will be converted to a fedora collection pid, which is of 
@@ -1333,7 +1336,4 @@
 	 * return nothing special except their names; browse (and any query)
 	 * return more complex XML responses.
-	 * All collections in this Digital Library (Fedora Repository) share 
-	 * the same services, so this method returns the same as 
-	 * describeService(serviceName). 
 	 * @param serviceName - the name of the service in the collection which is to 
 	 * be described.*/
@@ -1355,7 +1355,7 @@
 		attribute = doc.createAttribute(GSXML.TYPE_ATT);
 		
-		if(serviceName.toLowerCase().endsWith("retrieve"))
+		if(serviceName.toLowerCase().endsWith("retrieve")) {
 			attribute.setValue(GSXML.SERVICE_TYPE_RETRIEVE);
-		
+		} 
 		else if(serviceName.toLowerCase().contains("browse")) {
 			attribute.setValue(GSXML.SERVICE_TYPE_BROWSE);
@@ -1390,8 +1390,9 @@
 		else if(serviceName.toLowerCase().contains("query")) {
 			attribute.setValue(GSXML.SERVICE_TYPE_QUERY);
-			if(serviceName.equals("TextQuery"))
+			if(serviceName.equals("TextQuery")) {
 				describeTextQueryService(service);
-			else if(serviceName.equals("FieldQuery"))
+			} else if(serviceName.equals("FieldQuery")) {
 				describeFieldQueryService(service);
+			}
 		}
 		
@@ -2045,5 +2046,5 @@
 				// there may be fewer searchTerms than fieldNames (since some
 				// fieldNames may have been left empty), so loop on searchTerms
-				if(map.containsKey(fieldNames[i])) { //fieldName is already 
+				if(map.containsKey(fieldNames[i])) { // fieldName is already 
 					// in the list, so append comma with new value
 					String termsList = (String)map.get(fieldNames[i]);
