You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/07/23 16:15:02 UTC
svn commit: r558737 - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/processor/validation/
components/camel-bam/src/main/java/org/apache/camel/bam/processor/
Author: jstrachan
Date: Mon Jul 23 07:15:01 2007
New Revision: 558737
URL: http://svn.apache.org/viewvc?view=rev&rev=558737
Log:
minor refactor to introduce a new base exception which contains the message exchange which caused the actual exception
Added:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java (with props)
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidationException.java
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java
Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java?view=auto&rev=558737
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java Mon Jul 23 07:15:01 2007
@@ -0,0 +1,43 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel;
+
+/**
+ * An exception caused by a specific message {@ilnk Exchange}
+ *
+ * @version $Revision: 1.1 $
+ */
+public class CamelExchangeException extends CamelException {
+ private static final long serialVersionUID = -8721487431101572630L;
+ private final Exchange exchange;
+
+ public CamelExchangeException(String message, Exchange exchange) {
+ super(message + " on the exchange: " + exchange);
+ this.exchange = exchange;
+ }
+
+ /**
+ * Returns the exchange which caused the exception
+ *
+ * @return the exchange which caused the exception
+ */
+ public Exchange getExchange() {
+ return exchange;
+ }
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java?view=diff&rev=558737&r1=558736&r2=558737
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java Mon Jul 23 07:15:01 2007
@@ -26,13 +26,13 @@
*
* @version $Revision$
*/
-public class NoSuchPropertyException extends CamelException {
+public class NoSuchPropertyException extends CamelExchangeException {
private static final long serialVersionUID = -8721487431101572630L;
- private final String propertyName;
+ private final String propertyName;
private final Class<?> type;
public NoSuchPropertyException(Exchange exchange, String propertyName, Class<?> type) {
- super("No '"+ propertyName + "' property available of type: " + type.getName() + reason(exchange, propertyName) + " on the exchange: " + exchange);
+ super("No '"+ propertyName + "' property available of type: " + type.getName() + reason(exchange, propertyName), exchange);
this.propertyName = propertyName;
this.type = type;
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidationException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidationException.java?view=diff&rev=558737&r1=558736&r2=558737
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidationException.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/ValidationException.java Mon Jul 23 07:15:01 2007
@@ -18,24 +18,15 @@
import org.apache.camel.CamelException;
import org.apache.camel.Exchange;
+import org.apache.camel.CamelExchangeException;
/**
* @version $Revision: $
*/
-public class ValidationException extends CamelException {
- private Exchange exchange;
+public class ValidationException extends CamelExchangeException {
public ValidationException(Exchange exchange, String message) {
- super(message + ". Exchange" + exchange);
- this.exchange = exchange;
+ super(message, exchange);
}
- /**
- * Returns the exchange which caused the exception
- *
- * @return the exchange which caused the exception
- */
- public Exchange getExchange() {
- return exchange;
- }
}
Modified: activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java?view=diff&rev=558737&r1=558736&r2=558737
==============================================================================
--- activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java (original)
+++ activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java Mon Jul 23 07:15:01 2007
@@ -18,6 +18,7 @@
import org.apache.camel.CamelException;
import org.apache.camel.Exchange;
+import org.apache.camel.CamelExchangeException;
/**
* An exception thrown if no correlation key could be found for a message
@@ -26,20 +27,12 @@
*
* @version $Revision: $
*/
-public class NoCorrelationKeyException extends CamelException {
+public class NoCorrelationKeyException extends CamelExchangeException {
private BamProcessorSupport processor;
- private Exchange exchange;
public NoCorrelationKeyException(BamProcessorSupport processor, Exchange exchange) {
- super("No correlation key could be found for " + processor.getCorrelationKeyExpression()
- + " on " + exchange);
-
+ super("No correlation key could be found for " + processor.getCorrelationKeyExpression(), exchange);
this.processor = processor;
- this.exchange = exchange;
- }
-
- public Exchange getExchange() {
- return exchange;
}
public BamProcessorSupport getProcessor() {