[jboss-svn-commits] JBL Code SVN: r18798 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss: soa/esb/client and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 10 09:53:06 EDT 2008


Author: mark.little at jboss.com
Date: 2008-03-10 09:53:05 -0400 (Mon, 10 Mar 2008)
New Revision: 18798

Added:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierMarshalUnmarshalException.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierServiceBindException.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierTransportException.java
Modified:
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierException.java
   labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1564

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -23,6 +23,7 @@
 package org.jboss.internal.soa.esb.couriers;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
@@ -43,6 +44,9 @@
 import org.jboss.soa.esb.common.Environment;
 import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierTransportException;
+import org.jboss.soa.esb.couriers.CourierServiceBindException;
+import org.jboss.soa.esb.couriers.CourierMarshalUnmarshalException;
 import org.jboss.soa.esb.couriers.CourierTimeoutException;
 import org.jboss.soa.esb.couriers.CourierUtil;
 import org.jboss.soa.esb.listeners.message.errors.Factory;
@@ -176,7 +180,7 @@
 		FileHandler handler = (null != _localFhandler) ? _localFhandler
 				: FileHandlerFactory.getInstance().getFileHandler(_epr);
 		if (null == handler)
-			throw new CourierException(
+			throw new CourierServiceBindException(
 					"Can't find appropriate file handler for "
 							+ _url.toString());
 
@@ -210,16 +214,22 @@
 
 				return true;
 			}
-			catch (IOException e)
+			catch (final CourierException e)
 			{
-				throw new CourierException(e);
+			    throw new CourierTransportException(e);
 			}
-			catch (ParserConfigurationException e)
+			catch (final IOException e)
 			{
+				throw new CourierMarshalUnmarshalException(e);
+			}
+			catch (final ParserConfigurationException e)  // it's no longer thrown so we can ignore it!
+			{
 				throw new CourierException(e);
 			}
 		}
 
+		tmpFile = null;
+		
 		try
 		{
 			Method upload = handler.getClass().getMethod("uploadFile",
@@ -244,10 +254,15 @@
 			{ messageFile });
 			return true;
 		}
-		catch (Exception e)
+		catch (final IOException ex)
 		{
-			e.printStackTrace();
-			
+		    if (tmpFile == null)
+			throw new CourierMarshalUnmarshalException(ex);
+		    else
+			throw new CourierTransportException(ex);
+		}
+		catch (final Exception e)
+		{
 			throw new CourierException(e);
 		}
 		finally
@@ -280,8 +295,10 @@
 				{
 					result = readOneMessage(handler, work);
 				}
-				catch (Exception e)
+				catch (CourierException e)
 				{
+				    _logger.debug("FileCourier.pickup caught exception during readOneMessage: "+e);
+				    
 					if (null == errorFile(input))
 						handler.deleteFile(work);
 					else
@@ -328,8 +345,20 @@
 			{
 				return CourierUtil.messageFromLocalFile(work);
 			}
-			catch (Exception ex)
+			catch (final FileNotFoundException ex)
 			{
+			    throw new CourierTransportException(ex);
+			}
+			catch (final IOException ex)
+			{
+			    throw new CourierMarshalUnmarshalException(ex);
+			}
+			catch (final CourierException ex)
+			{
+			    throw ex;
+			}
+			catch (final Exception ex)
+			{
 				throw new CourierException(ex);
 			}
 		}
@@ -344,9 +373,21 @@
 			{ work });
 			return CourierUtil.messageFromLocalFile(tmpFile);
 		}
+		catch (FileNotFoundException ex)
+		{
+		    throw new CourierTransportException(ex);
+		}
+		catch (IOException ex)
+		{
+		    throw new CourierTransportException(ex);
+		}
+		catch (final CourierException ex)
+		{
+		    throw ex;
+		}
 		catch (Exception e)
 		{
-			throw new CourierException(e);
+			throw new CourierTransportException(e);
 		}
 		finally
 		{

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/HibernateCourier.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -28,6 +28,7 @@
 import org.apache.log4j.Logger;
 import org.hibernate.Query;
 import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.MalformedEPRException;
 import org.jboss.soa.esb.addressing.eprs.HibernateEpr;
 import org.jboss.soa.esb.couriers.CourierException;
 import org.jboss.soa.esb.couriers.CourierTimeoutException;
@@ -85,13 +86,18 @@
 	 * @throws CourierException -
 	 *             if problems were encountered
 	 */
-	public boolean deliver(Message message) throws CourierException {
+	public boolean deliver(Message message) throws CourierException, MalformedEPRException {
 		if (m_isReceiver)
 			throw new CourierException("This is a read-only Courier");
 
 		if (null == message)
 			return false;
 
+		/*
+		 * This method doesn't really do anything about delivering
+		 * the message. And pickup doesn't return a message either.
+		 */
+		
 		Call call = message.getHeader().getCall();
 		if (null==call)
 			message.getHeader().setCall(call=new Call());
@@ -99,7 +105,7 @@
 			if (null == call.getMessageID())
 				call.setMessageID(new URI(UUID.randomUUID().toString()));
 		} catch (URISyntaxException e) {
-			throw new CourierException("Problems with message header ",e);
+			throw new MalformedEPRException("Problems with message header ",e);
 		}
 
 		return false;

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -53,7 +53,10 @@
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.common.TransactionStrategy;
 import org.jboss.soa.esb.common.TransactionStrategyException;
+import org.jboss.soa.esb.couriers.CourierTransportException;
 import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierServiceBindException;
+import org.jboss.soa.esb.couriers.CourierMarshalUnmarshalException;
 import org.jboss.soa.esb.couriers.CourierTimeoutException;
 import org.jboss.soa.esb.helpers.KeyValuePair;
 import org.jboss.soa.esb.helpers.NamingContextException;
@@ -156,7 +159,7 @@
                     try {
                         sType = _epr.getDestinationType();
                     } catch (URISyntaxException e) {
-                        throw new CourierException("EPR.getDestinationType failed.", e);
+                        throw new CourierServiceBindException("EPR.getDestinationType failed.", e);
                     }
 
                     try {
@@ -166,11 +169,11 @@
                             jmsSession = getConnectionPool().getTopicSession(acknowledgeMode);
                         }
                     } catch (NamingException e) {
-                        throw new CourierException("Failed to get JMS Session from pool.", e);
+                        throw new CourierServiceBindException("Failed to get JMS Session from pool.", e);
                     } catch (JMSException e) {
-                        throw new CourierException("Failed to get JMS Session from pool.", e);
+                        throw new CourierServiceBindException("Failed to get JMS Session from pool.", e);
                     } catch (ConnectionException e) {
-                        throw new CourierException("Failed to get JMS Session from pool.", e);
+                        throw new CourierServiceBindException("Failed to get JMS Session from pool.", e);
                     }
                 }
             }
@@ -198,7 +201,7 @@
             try {
                 createMessageProducer();
             } catch (final NamingContextException nce) {
-                throw new CourierException("Unexpected exception attempting to access naming context pool", nce) ;
+                throw new CourierServiceBindException("Unexpected exception attempting to access naming context pool", nce) ;
             }
         }
 
@@ -206,18 +209,18 @@
         try {
             msg = getJmsSession(_epr.getAcknowledgeMode()).createObjectMessage(Util.serialize(message));
         } catch (JMSException e) {
-            throw new CourierException("Failed to serialize ESB Message.", e);
+            throw new CourierMarshalUnmarshalException("Failed to serialize ESB Message.", e);
         } catch (ParserConfigurationException e) {
-            throw new CourierException("Failed to serialize ESB Message.", e);
+            throw new CourierMarshalUnmarshalException("Failed to serialize ESB Message.", e);
         } catch (IOException e) {
-            throw new CourierException("Failed to serialize ESB Message.", e);
+            throw new CourierMarshalUnmarshalException("Failed to serialize ESB Message.", e);
         }
 
         // Set the JMS message from the ESB message...
         try {
             setJMSProperties(message, msg);
         } catch (JMSException e) {
-            throw new CourierException("Failed to set JMS Message properties from ESB Message properties.", e);
+            throw new CourierMarshalUnmarshalException("Failed to set JMS Message properties from ESB Message properties.", e);
         }
 
         return deliver(msg);
@@ -246,7 +249,7 @@
             try {
                 createMessageProducer();
             } catch (final NamingContextException nce) {
-                throw new CourierException("Unexpected exception attempting to access naming context pool", nce) ;
+                throw new CourierServiceBindException("Unexpected exception attempting to access naming context pool", nce) ;
             }
         }
 
@@ -268,8 +271,12 @@
                 return true;
             }
             catch (JMSException e) {
-                jmsConnectRetry(e);
+                if (!jmsConnectRetry(e))
+                    throw new CourierTransportException("Caught exception during delivery and could not reconnect! ",e);
             }
+            catch (final CourierException e) {
+        	throw e;
+            }
             catch (Exception e) {
                 throw new CourierException(e);
             }
@@ -294,7 +301,7 @@
 
     } // ________________________________
 
-    private void jmsConnectRetry(Exception exc) {
+    private boolean jmsConnectRetry(Exception exc) {
         _logger.debug("JMS error.  Attempting JMS reconnect.", exc);
 
         synchronized(this) {
@@ -320,10 +327,14 @@
                         }
                     } else {
                         _logger.debug("Failed to reconnect to JMS", e);
+                        
+                        return false;
                     }
                 }
             }
         }
+        
+        return true;
     } // ________________________________
 
     private void createMessageProducer() throws CourierException, NamingContextException {
@@ -541,10 +552,11 @@
                 break;
             }
             catch (JMSException e) {
-                jmsConnectRetry(e);
+                if (!jmsConnectRetry(e))
+                    throw new CourierTransportException("Caught exception during receive and could not reconnect! ",e);
             }
             catch (Exception e) {
-                throw new CourierException(e);
+                throw new CourierTransportException(e);
             }
         }
         return jmsMessage;

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -22,6 +22,7 @@
 
 package org.jboss.internal.soa.esb.couriers;
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -40,7 +41,10 @@
 import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
 import org.jboss.soa.esb.common.TransactionStrategy;
 import org.jboss.soa.esb.common.TransactionStrategyException;
+import org.jboss.soa.esb.couriers.CourierTransportException;
 import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierServiceBindException;
+import org.jboss.soa.esb.couriers.CourierMarshalUnmarshalException;
 import org.jboss.soa.esb.couriers.CourierTimeoutException;
 import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
 import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
@@ -177,9 +181,9 @@
 			{
 				_conn = getConn();
 			}
-			catch (Exception e)
+			catch (final Exception e)
 			{
-				throw new CourierException(e);
+				throw new CourierServiceBindException(e);
 			}
 		}
 
@@ -217,11 +221,12 @@
 				}
 				
 				_logger.debug("SQL exception during deliver", e);
-				throw new CourierException(e);
+				throw new CourierTransportException(e);
 			}
 			catch (Exception e)
 			{
-				jdbcConnectRetry(e);
+				if (!jdbcConnectRetry(e))
+				    throw new CourierTransportException("Caught exception during delivery and could not reconnect! ",e);
 			}
 		}
 		return false;
@@ -255,7 +260,9 @@
 				
 				if (transactional && !isActive)
 				{
-					throw new CourierException("Associated transaction is no longer active!");
+				    _logger.error("SqlTableCourier - associated transaction is no longer active!");
+				   
+				    throw new CourierException("Associated transaction is no longer active!");
 				}
 			}
 			catch (TransactionStrategyException ex)
@@ -291,8 +298,9 @@
 			}
 			catch (SQLException e)
 			{
-			    _logger.debug("SQL Exception during pickup", e);
-			    return null;
+			    _logger.warn("SQL Exception during pickup", e);
+			    
+			    throw new CourierTransportException(e);
 			}
 			finally
 			{
@@ -372,6 +380,10 @@
 					{
 						eBad = e;
 					}
+					catch (final IOException e)
+					{
+					    throw new CourierMarshalUnmarshalException(e);
+					}
 					catch (Exception e)
 					{
 						throw new CourierException(e);
@@ -389,11 +401,14 @@
 			}
 			catch (SQLException e)
 			{
-				throw new CourierException(e);
+				throw new CourierTransportException(e);
 			}
 			catch (Exception ex)
 			{
-				jdbcConnectRetry(ex);
+			    // bail-out now if we can't reconnect, rather than lose the error in the next sweep.
+			    
+				if (!jdbcConnectRetry(ex))
+				    throw new CourierTransportException("Caught unexpected exception during SQL receive and could not reconnect!", ex);
 			}
 			finally
 			{
@@ -440,9 +455,9 @@
 			{
 				_conn = getConn();
 			}
-			catch (Exception e)
+			catch (final Exception e)
 			{
-				throw new CourierException(e);
+				throw new CourierServiceBindException(e);
 			}
 		}
 		while (_conn != null)
@@ -463,7 +478,7 @@
 
 	} // _______________________________
 
-	private void jdbcConnectRetry(Exception exc)
+	private boolean jdbcConnectRetry(Exception exc)
 	{
 		_logger.debug("DB problem, will try to reconnect", exc);
 		
@@ -485,10 +500,12 @@
 				}
 				catch (InterruptedException eInt)
 				{
-					return;
+					return false;
 				}
 			}
 		}
+
+		return !(_conn == null);
 	} // ________________________________
 
 	private JdbcCleanConn getConn() throws SQLException, MalformedEPRException, NamingException

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -38,6 +38,9 @@
 import org.jboss.soa.esb.couriers.Courier;
 import org.jboss.soa.esb.couriers.CourierException;
 import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.couriers.CourierTransportException;
+import org.jboss.soa.esb.couriers.CourierServiceBindException;
+import org.jboss.soa.esb.couriers.CourierMarshalUnmarshalException;
 import org.jboss.soa.esb.couriers.CourierUtil;
 import org.jboss.soa.esb.couriers.FaultMessageException;
 import org.jboss.soa.esb.couriers.TwoWayCourier;
@@ -470,7 +473,7 @@
          * @return Returns the message (or a reply message if synchronous) if the message was delivered
          *         without error, otherwise null.
          */
-        private Message attemptDelivery(Message message, EPR epr) throws FaultMessageException, MalformedEPRException {
+        private Message attemptDelivery(Message message, EPR epr) throws FaultMessageException, MalformedEPRException, MessageDeliverException {
             TwoWayCourier courier = null;
 
             final EPR targetEPR ;
@@ -533,15 +536,35 @@
                     }
                 } catch (FaultMessageException e) {
                     throw e;
+                } catch (final CourierServiceBindException e) {
+                    // meant to be masked by the SI fail-over
+                    
+                    logger.debug("Caught service lookup exception for EPR [" + targetEPR + "] and Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
+                    
+                    // could be stale EPR, so move on to next entry in registry.
+                } catch (final CourierMarshalUnmarshalException e) {
+                    logger.warn("Courier indicated (un)marshal related error "+e+" during delivery to EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
+                    
+                    throw new MessageDeliverException("Caught (un)marshal related exception during attempted send/receive: "+e);
+                } catch (final CourierTransportException e) {
+                    // meant to be masked by the SI fail-over
+                    
+                    logger.debug("Courier indicated transport related error "+e+" during send/receive with EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
                 } catch (CourierException e) {
-                    logger.debug("Badly formed EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
+                    // probable config error. Log it and move on to next EPR/service entry.
+                    
+                    logger.warn("Possible configuration error while using Courier for EPR [" + targetEPR + "] and Service [" + service + "] and Message ["+message.getHeader()+"]. " + e.getMessage());
                 } catch (MalformedEPRException e) {
                     // Hmmmm???... Can this really happen?  The Courier has already been created.  Haven't we already validated the EPR during the Courier lookup (above)??
-                    logger.warn("Unexpected error.  Badly formed EPR [" + targetEPR + "] for Service [" + service + "]. But the EPR has already been validated!!");
+                    logger.error("Unexpected error.  Badly formed EPR [" + targetEPR + "] for Service [" + service + "]. But the EPR has already been validated!!");
                     
                     throw e;
                 } catch (Throwable t) {
-                    logger.warn("Unexpected exception during attempted message delivery over Courier for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", t);
+                    logger.error("Unexpected throwable during attempted message delivery using Courier for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", t);
+                    
+                    // we don't know what state we're in so better to bail-out now!
+                    
+                    throw new MessageDeliverException("Caught unexpected throwable during send. Bailing-out! "+t);
                 } finally {
                     // TODO: So does this mean that Couriers are stateful?  If so, do we need to synchronize on using them??
                     CourierUtil.cleanCourier(courier);

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierException.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierException.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierException.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -25,7 +25,14 @@
 import org.jboss.soa.esb.BaseException;
 
 /**
- * Dispatch Exception.
+ * General Courier exception. Consider this like SystemException. Other
+ * more specific exceptions will be derived from it. Most CourierExceptions
+ * are for configuration problems.
+ * 
+ * Note: to preserve existing signatures.
+ * Note: an alternative approach would be similar to SQLException or XAException
+ * with specific error codes.
+ * 
  * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
  * @since Version 4.0
  */

Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierMarshalUnmarshalException.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierMarshalUnmarshalException.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierMarshalUnmarshalException.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.couriers;
+
+/**
+ * Problems with the Message that cause delivery to fail. Typically
+ * around marshalling or unmarshalling the Message.
+ * 
+ * @since Version 4.2.1CP2
+ */
+
+public class CourierMarshalUnmarshalException extends CourierException
+{
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct an exception instance.
+	 * 
+	 * @param message
+	 *            Exception message.
+	 */
+
+	public CourierMarshalUnmarshalException(String message)
+	{
+		super(message);
+	}
+	
+	public CourierMarshalUnmarshalException(String message, Throwable cause)
+	{
+		super(message, cause);
+	}
+
+	public CourierMarshalUnmarshalException (Throwable cause)
+	{
+	    super(cause);
+	}
+}

Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierServiceBindException.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierServiceBindException.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierServiceBindException.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.couriers;
+
+/**
+ * An error happened during the service bind or look-up. This could be while
+ * communicating with the Registry or afterwards, while trying to
+ * set up (or bind to) the specific service.
+ * 
+ * @since Version 4.2.1CP2
+ */
+
+public class CourierServiceBindException extends CourierException
+{
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct an exception instance.
+	 * 
+	 * @param message
+	 *            Exception message.
+	 */
+
+	public CourierServiceBindException(String message)
+	{
+		super(message);
+	}
+	
+	public CourierServiceBindException(String message, Throwable cause)
+	{
+		super(message, cause);
+	}
+
+	public CourierServiceBindException (Throwable cause)
+	{
+	    super(cause);
+	}
+}

Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierTransportException.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierTransportException.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierTransportException.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.couriers;
+
+/**
+ * Some transport related error was encountered during send or receive.
+ * 
+ * @since Version 4.2.1CP2
+ */
+
+public class CourierTransportException extends CourierException
+{
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Construct an exception instance.
+	 * 
+	 * @param message
+	 *            Exception message.
+	 */
+
+	public CourierTransportException(String message)
+	{
+		super(message);
+	}
+	
+	public CourierTransportException(String message, Throwable cause)
+	{
+		super(message, cause);
+	}
+
+	public CourierTransportException (Throwable cause)
+	{
+	    super(cause);
+	}
+}

Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java	2008-03-10 13:49:14 UTC (rev 18797)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java	2008-03-10 13:53:05 UTC (rev 18798)
@@ -28,7 +28,6 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.io.StreamCorruptedException;
@@ -137,6 +136,8 @@
 		
 		while (retry > 0)
 		{
+		    serial = null;
+		    
 			try
 			{
 				reader = new FileInputStream(from);
@@ -149,6 +150,13 @@
 				
 				retry--;
 			}
+			catch (final IOException ex)
+			{
+			    if (serial == null)
+				throw new CourierTransportException(ex);
+			    else
+				throw new CourierMarshalUnmarshalException(ex);
+			}
 			catch (Exception e)
 			{
 				e.printStackTrace();




More information about the jboss-svn-commits mailing list