[teiid-commits] teiid SVN: r3675 - in branches/7.6.x/connectors/connector-ws/src: main/resources/org/teiid/resource/adapter/ws and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sat Nov 19 08:32:29 EST 2011


Author: shawkins
Date: 2011-11-19 08:32:27 -0500 (Sat, 19 Nov 2011)
New Revision: 3675

Modified:
   branches/7.6.x/connectors/connector-ws/src/main/java/org/teiid/resource/adapter/ws/WSConnectionImpl.java
   branches/7.6.x/connectors/connector-ws/src/main/resources/org/teiid/resource/adapter/ws/i18n.properties
   branches/7.6.x/connectors/connector-ws/src/test/java/org/teiid/resource/adapter/ws/TestWSAdapter.java
Log:
TEIID-1836 adding a null check to avoid an npe

Modified: branches/7.6.x/connectors/connector-ws/src/main/java/org/teiid/resource/adapter/ws/WSConnectionImpl.java
===================================================================
--- branches/7.6.x/connectors/connector-ws/src/main/java/org/teiid/resource/adapter/ws/WSConnectionImpl.java	2011-11-18 21:31:46 UTC (rev 3674)
+++ branches/7.6.x/connectors/connector-ws/src/main/java/org/teiid/resource/adapter/ws/WSConnectionImpl.java	2011-11-19 13:32:27 UTC (rev 3675)
@@ -210,6 +210,9 @@
 				String defaultEndpoint = mcf.getEndPoint();
 				String defaultQueryString = null;
 				String defaultFragment = null;
+				if (defaultEndpoint == null) {
+					throw new WebServiceException(WSManagedConnectionFactory.UTIL.getString("null_default_endpoint")); //$NON-NLS-1$
+				}
 				String[] parts = defaultEndpoint.split("\\?", 2); //$NON-NLS-1$
 				defaultEndpoint = parts[0];
 				if (parts.length > 1) {

Modified: branches/7.6.x/connectors/connector-ws/src/main/resources/org/teiid/resource/adapter/ws/i18n.properties
===================================================================
--- branches/7.6.x/connectors/connector-ws/src/main/resources/org/teiid/resource/adapter/ws/i18n.properties	2011-11-18 21:31:46 UTC (rev 3674)
+++ branches/7.6.x/connectors/connector-ws/src/main/resources/org/teiid/resource/adapter/ws/i18n.properties	2011-11-19 13:32:27 UTC (rev 3675)
@@ -20,4 +20,5 @@
 # 02110-1301 USA.
 #
 
-null_endpoint=An endpoint must be specified by the procedure call or have a default value set by the EndPoint datasource property. 
\ No newline at end of file
+null_endpoint=An endpoint must be specified by the procedure call or have a default value set by the EndPoint datasource property.
+null_default_endpoint=The use of a relative endpoint in a procedure call requires a a default endpoint on the datasource. 
\ No newline at end of file

Modified: branches/7.6.x/connectors/connector-ws/src/test/java/org/teiid/resource/adapter/ws/TestWSAdapter.java
===================================================================
--- branches/7.6.x/connectors/connector-ws/src/test/java/org/teiid/resource/adapter/ws/TestWSAdapter.java	2011-11-18 21:31:46 UTC (rev 3674)
+++ branches/7.6.x/connectors/connector-ws/src/test/java/org/teiid/resource/adapter/ws/TestWSAdapter.java	2011-11-19 13:32:27 UTC (rev 3675)
@@ -32,11 +32,18 @@
 
 public class TestWSAdapter {
 	
-	@Test(expected=WebServiceException.class) public void testMissingBinding() throws ResourceException {
+	@Test(expected=WebServiceException.class) public void testMissingEndpoint() throws ResourceException {
 		WSManagedConnectionFactory wsmcf = new WSManagedConnectionFactory();
 		
 		WSConnectionImpl conn = (WSConnectionImpl)wsmcf.createConnectionFactory().getConnection();
 		conn.createDispatch(HTTPBinding.HTTP_BINDING, null, StreamSource.class, Mode.PAYLOAD);
 	}
+	
+	@Test(expected=WebServiceException.class) public void testMissingEndpoint1() throws ResourceException {
+		WSManagedConnectionFactory wsmcf = new WSManagedConnectionFactory();
+		
+		WSConnectionImpl conn = (WSConnectionImpl)wsmcf.createConnectionFactory().getConnection();
+		conn.createDispatch(HTTPBinding.HTTP_BINDING, "/x", StreamSource.class, Mode.PAYLOAD); //$NON-NLS-1$
+	}
 
 }



More information about the teiid-commits mailing list