Author: davsclaus
Date: Sat Feb 5 12:00:56 2011
New Revision: 1067428
URL: http://svn.apache.org/viewvc?rev=1067428&view=rev
Log:
CAMEL-3603: Using IOException with nested exception. Deprecated IOHelp[er.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileBinding.java
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
camel/trunk/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/handler/BasicValidationHandler.java
camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInvocation.java
Sat Feb 5 12:00:56 2011
@@ -25,7 +25,6 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.camel.Exchange;
-import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,7 +99,7 @@ public class BeanInvocation implements E
try {
method = methodBean.getMethod();
} catch (NoSuchMethodException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
args = ObjectHelper.cast(Object[].class, objectInput.readObject());
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileBinding.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileBinding.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileBinding.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileBinding.java
Sat Feb 5 12:00:56 2011
@@ -21,7 +21,6 @@ import java.io.IOException;
import org.apache.camel.Exchange;
import org.apache.camel.NoTypeConversionAvailableException;
-import org.apache.camel.util.IOHelper;
/**
* File binding with the {@link java.io.File} type.
@@ -57,7 +56,7 @@ public class FileBinding implements Gene
try {
content =
exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class,
file.getFile());
} catch (NoTypeConversionAvailableException e) {
- throw IOHelper.createIOException("Cannot load file content: "
+ file.getAbsoluteFilePath(), e);
+ throw new IOException("Cannot load file content: " +
file.getAbsoluteFilePath(), e);
}
}
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
Sat Feb 5 12:00:56 2011
@@ -30,7 +30,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.StreamCache;
import org.apache.camel.impl.SynchronizationAdapter;
import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -155,7 +154,7 @@ public class CachedOutputStream extends
}
return fileInputStreamCache;
} catch (FileNotFoundException e) {
- throw IOHelper.createIOException("Cached file " + tempFile + "
not found", e);
+ throw new IOException("Cached file " + tempFile + " not
found", e);
}
}
}
@@ -182,7 +181,7 @@ public class CachedOutputStream extends
}
return fileInputStreamCache;
} catch (FileNotFoundException e) {
- throw IOHelper.createIOException("Cached file " + tempFile + "
not found", e);
+ throw new IOException("Cached file " + tempFile + " not
found", e);
}
}
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
Sat Feb 5 12:00:56 2011
@@ -67,7 +67,10 @@ public final class IOHelper {
/**
* A factory method which creates an {@link IOException} from the given
* exception and message
+ *
+ * @deprecated IOException support nested exception in Java 1.6.
*/
+ @Deprecated
public static IOException createIOException(Throwable cause) {
return createIOException(cause.getMessage(), cause);
}
@@ -75,7 +78,10 @@ public final class IOHelper {
/**
* A factory method which creates an {@link IOException} from the given
* exception and message
+ *
+ * @deprecated IOException support nested exception in Java 1.6.
*/
+ @Deprecated
public static IOException createIOException(String message, Throwable
cause) {
IOException answer = new IOException(message);
answer.initCause(cause);
Modified:
camel/trunk/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
(original)
+++
camel/trunk/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
Sat Feb 5 12:00:56 2011
@@ -186,7 +186,7 @@ public class CryptoDataFormat implements
+ " '%d' bytes were retrieved", ivLength, read));
}
} catch (IOException e) {
- throw IOHelper.createIOException("Error Reading Initialization
vector from encrypted stream", e);
+ throw new IOException("Error reading initialization vector
from encrypted stream", e);
}
}
return iv;
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
(original)
+++
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
Sat Feb 5 12:00:56 2011
@@ -33,7 +33,6 @@ import org.apache.camel.component.cxf.ut
import org.apache.camel.component.cxf.util.CxfMessageHelper;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.util.IOHelper;
import org.apache.cxf.Bus;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.Configurable;
@@ -195,7 +194,7 @@ public class CamelConduit extends Abstra
// TODO support different encoding
exchange.getIn().setBody(outputStream.getBytes());
getLogger().log(Level.FINE, "template sending request: ",
exchange.getIn());
- Exception exception = null;
+ Exception exception;
try {
producer.process(exchange);
} catch (Exception ex) {
@@ -204,7 +203,7 @@ public class CamelConduit extends Abstra
// Throw the exception that the template get
exception = exchange.getException();
if (exception != null) {
- throw IOHelper.createIOException("Can't send the request
message.", exchange.getException());
+ throw new IOException("Cannot send the request message.",
exchange.getException());
}
exchange.setProperty(CxfConstants.CXF_EXCHANGE,
outMessage.getExchange());
if (!isOneWay) {
@@ -216,11 +215,9 @@ public class CamelConduit extends Abstra
private void handleResponse(org.apache.camel.Exchange exchange) throws
IOException {
org.apache.cxf.message.Message inMessage = null;
try {
- inMessage =
CxfMessageHelper.getCxfInMessage(headerFilterStrategy,
- exchange, true);
+ inMessage =
CxfMessageHelper.getCxfInMessage(headerFilterStrategy, exchange, true);
} catch (Exception ex) {
- // Throw IOException here
- throw IOHelper.createIOException("Can't get the response
message. ", ex);
+ throw new IOException("Cannot get the response message. ", ex);
}
incomingObserver.onMessage(inMessage);
}
Modified:
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
(original)
+++
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
Sat Feb 5 12:00:56 2011
@@ -269,7 +269,7 @@ public class DefaultHttpBinding implemen
// object is written so return
return;
} catch (InvalidPayloadException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
}
Modified:
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
(original)
+++
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
Sat Feb 5 12:00:56 2011
@@ -268,7 +268,7 @@ public class DefaultHttpBinding implemen
// object is written so return
return;
} catch (InvalidPayloadException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
}
Modified:
camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/handler/BasicValidationHandler.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/handler/BasicValidationHandler.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/handler/BasicValidationHandler.java
(original)
+++
camel/trunk/components/camel-http4/src/test/java/org/apache/camel/component/http4/handler/BasicValidationHandler.java
Sat Feb 5 12:00:56 2011
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import org.apache.camel.util.IOHelper;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpException;
@@ -67,7 +66,7 @@ public class BasicValidationHandler impl
return;
}
} catch (URISyntaxException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
if (expectedContent != null) {
Modified:
camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java?rev=1067428&r1=1067427&r2=1067428&view=diff
==============================================================================
---
camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
(original)
+++
camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
Sat Feb 5 12:00:56 2011
@@ -96,9 +96,9 @@ public class JaxbDataFormat extends Serv
marshal(exchange, graph, stream, marshaller);
} catch (JAXBException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
} catch (XMLStreamException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
}
@@ -155,7 +155,7 @@ public class JaxbDataFormat extends Serv
}
return answer;
} catch (JAXBException e) {
- throw IOHelper.createIOException(e);
+ throw new IOException(e);
}
}