You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/09/14 10:43:40 UTC

[jira] Created: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

hawtdb - Should wrap caused exception in wrapped IOException
------------------------------------------------------------

                 Key: CAMEL-3120
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
             Project: Apache Camel
          Issue Type: Improvement
    Affects Versions: 2.4.0
            Reporter: Claus Ibsen
            Assignee: Hiram Chirino
            Priority: Minor
             Fix For: 2.6.0


The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.

For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.

{code}

    public T decode(DataInput dataIn) throws IOException {
        int size = dataIn.readInt();
        byte[] data = new byte[size];
        dataIn.readFully(data);
        ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
        ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
        try {
            return (T) objectIn.readObject();
        } catch (ClassNotFoundException e) {
            throw new IOException(e.getMessage());
        }
    }
{code}

For being JDK 1.5 compatible you need to do it like
{code}
    public static IOException createIOException(String message, Throwable cause) {
        IOException answer = new IOException(message);
        answer.initCause(cause);
        return answer;
    }
{code}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61808#action_61808 ] 

Claus Ibsen commented on CAMEL-3120:
------------------------------------

Also hawtdb may have to change how it loads the class. See for example from AMQ:
http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-3120) hawtdb - Should work in OSGi

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3120.
--------------------------------

    Resolution: Fixed

Now it works with hawtdb 1.4 and hawtbuf 1.2

> hawtdb - Should work in OSGi
> ----------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3120:
-------------------------------

    Attachment: CAMEL-3120-buf.patch

Patch for hawtdb-buf

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61809#action_61809 ] 

Claus Ibsen commented on CAMEL-3120:
------------------------------------

The stacktrace is now
{code}
Caused by: java.io.IOException: org.apache.camel.impl.DefaultExchangeHolder
	at org.fusesource.hawtbuf.codec.ObjectCodec.createIOException(ObjectCodec.java:60)
	at org.fusesource.hawtbuf.codec.ObjectCodec.decode(ObjectCodec.java:55)
	at org.apache.camel.component.hawtdb.HawtDBCamelCodec.unmarshallExchange(HawtDBCamelCodec.java:74)
	at org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:159)
	... 56 more
Caused by: java.lang.ClassNotFoundException: org.apache.camel.impl.DefaultExchangeHolder
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1484)
	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:695)
	at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1656)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
	at org.fusesource.hawtbuf.codec.ObjectCodec.decode(ObjectCodec.java:51)
	... 58 more
{code}

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3120:
-------------------------------

    Attachment: CAMEL-3120-db.patch

Patch for hawtdb

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-3120) hawtdb - Should work in OSGi

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-3120:
----------------------------------

    Assignee: Claus Ibsen  (was: Hiram Chirino)

> hawtdb - Should work in OSGi
> ----------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3120) hawtdb - Should work in OSGi

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3120:
-------------------------------

    Summary: hawtdb - Should work in OSGi  (was: hawtdb - Should wrap caused exception in wrapped IOException)

> hawtdb - Should work in OSGi
> ----------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61810#action_61810 ] 

Claus Ibsen commented on CAMEL-3120:
------------------------------------

And when using equinox

{code}
Caused by: java.io.IOException: org.apache.camel.impl.DefaultExchangeHolder
	at org.fusesource.hawtbuf.codec.ObjectCodec.createIOException(ObjectCodec.java:60)
	at org.fusesource.hawtbuf.codec.ObjectCodec.decode(ObjectCodec.java:55)
	at org.apache.camel.component.hawtdb.HawtDBCamelCodec.unmarshallExchange(HawtDBCamelCodec.java:74)
	at org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:159)
	... 56 more
Caused by: java.lang.ClassNotFoundException: org.apache.camel.impl.DefaultExchangeHolder
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
	at org.fusesource.hawtbuf.codec.ObjectCodec.decode(ObjectCodec.java:51)
	at org.apache.camel.component.hawtdb.HawtDBCamelCodec.unmarshallExchange(HawtDBCamelCodec.java:74)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:159)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.apache.camel.processor.aggregate.AggregateProcessor.doAggregation(AggregateProcessor.java:207)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.apache.camel.processor.aggregate.AggregateProcessor.process(AggregateProcessor.java:184)
	at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
	at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
	at org.fusesource.hawtbuf.codec.ObjectCodec.decode(ObjectCodec.java:51)
	... 58 more
{code}

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61813#action_61813 ] 

Claus Ibsen commented on CAMEL-3120:
------------------------------------

Hiram can you apply the patches to hawtbuf and hawtdb?

Also we need a new release of hawtdb/buf so we can have it work with Apache ServiceMix and OSGi.

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3120) hawtdb - Should wrap caused exception in wrapped IOException

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3120:
-------------------------------

       Issue Type: Bug  (was: Improvement)
    Fix Version/s: 2.5.0
                       (was: 2.6.0)

> hawtdb - Should wrap caused exception in wrapped IOException
> ------------------------------------------------------------
>
>                 Key: CAMEL-3120
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3120
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Hiram Chirino
>            Priority: Minor
>             Fix For: 2.5.0
>
>         Attachments: CAMEL-3120-buf.patch, CAMEL-3120-db.patch
>
>
> The {{decode}} method in {{ObjectCodec}} should wrap the causes stacktrace in the wrapped IOException.
> For example OSGi frameworks may be pesky and we want to be able to see whatever stacktrace it may thrown on you.
> {code}
>     public T decode(DataInput dataIn) throws IOException {
>         int size = dataIn.readInt();
>         byte[] data = new byte[size];
>         dataIn.readFully(data);
>         ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
>         ObjectInputStream objectIn = new ObjectInputStream(bytesIn);
>         try {
>             return (T) objectIn.readObject();
>         } catch (ClassNotFoundException e) {
>             throw new IOException(e.getMessage());
>         }
>     }
> {code}
> For being JDK 1.5 compatible you need to do it like
> {code}
>     public static IOException createIOException(String message, Throwable cause) {
>         IOException answer = new IOException(message);
>         answer.initCause(cause);
>         return answer;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.