SCOUT-99
Put the fault handling code before the unmarshalling code in RegistryImpl
so that if both a fault and an unmarshalling error occurs, we get the base fault.


git-svn-id: https://svn.apache.org/repos/asf/webservices/scout/trunk@955243 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java b/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
index d3d7408..4f1912f 100644
--- a/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
+++ b/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
@@ -327,32 +327,8 @@
 	    if (responseName == null) {
 	        throw new RegistryException("Unsupported response "
 	                + "from registry. A value was not present.");
-		} 
+		} 	    
 	    
-        // Let's now try to determine which UDDI response
-        // we received and unmarshal it appropriately or
-        // throw a RegistryException if it's unknown.
-        // Well, we have now determined that something was
-        // returned and it is "a something" that we know
-        // about so let's unmarshal it into a RegistryObject
-        // Next, let's make sure we didn't recieve a SOAP
-        // Fault. If it is a SOAP Fault then throw it
-        // immediately.
-
-        JAXBElement<?> uddiResponse = null;
-	    try {
-	    	String xml = XMLUtils.convertNodeToXMLString(response);
-	        log.debug("Response is: " + xml);
-	    	
-		StringReader reader = new StringReader(xml);
-		uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader));
-	    	//It is probably faster not to go to a String, but JAXB has issues with this
-	        //uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response);
-
-	    } catch (JAXBException xmle) {
-	        throw (new RegistryException(xmle));
-	    }
-
 		if (responseName.toLowerCase().equals("fault")) {
 			NodeList nodeList = null;
 			
@@ -395,6 +371,30 @@
 			// Create RegistryException instance and return
 			throw e;
 		}
+	    
+        // Let's now try to determine which UDDI response
+        // we received and unmarshal it appropriately or
+        // throw a RegistryException if it's unknown.
+        // Well, we have now determined that something was
+        // returned and it is "a something" that we know
+        // about so let's unmarshal it into a RegistryObject
+        // Next, let's make sure we didn't recieve a SOAP
+        // Fault. If it is a SOAP Fault then throw it
+        // immediately.
+
+        JAXBElement<?> uddiResponse = null;
+	    try {
+	    	String xml = XMLUtils.convertNodeToXMLString(response);
+	        log.debug("Response is: " + xml);
+	        
+	        StringReader reader = new StringReader(xml);
+	        uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader));
+	    	//It is probably faster not to go to a String, but JAXB has issues with this
+	        //uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response);
+
+	    } catch (JAXBException xmle) {
+	        throw (new RegistryException(xmle));
+	    }
 
 		return uddiResponse;
 	}