[
https://issues.jboss.org/browse/ISPN-1514?page=com.atlassian.jira.plugin....
]
Thomas Fromm commented on ISPN-1514:
------------------------------------
Possible fix for AbstractMarshaller.objectFromInputStream:
public Object objectFromInputStream(InputStream inputStream) throws IOException,
ClassNotFoundException {
int len = inputStream.available();
ExposedByteArrayOutputStream bytes;
byte[] buf;
// ISPN-1514
if(len > 0){
bytes = new ExposedByteArrayOutputStream(len);
buf = new byte[Math.min(len, 1024)];
} else {
bytes = new ExposedByteArrayOutputStream();
buf = new byte[1024];
}
int bytesRead;
while ((bytesRead = inputStream.read(buf, 0, buf.length)) != -1) bytes.write(buf,
0, bytesRead);
return objectFromByteBuffer(bytes.getRawBuffer(), 0, bytes.size());
}
Unmarshalling fails with oracle driver
--------------------------------------
Key: ISPN-1514
URL:
https://issues.jboss.org/browse/ISPN-1514
Project: Infinispan
Issue Type: Bug
Components: Loaders and Stores
Affects Versions: 5.1.0.BETA3
Environment: Oracle Driver version 10.2.0.5.0
Reporter: Thomas Fromm
Assignee: Galder ZamarreƱo
Fix For: 5.1.0.CR1
Unmarshalling of value with oracle driver fails with:
2011-11-09 14:57:59,490 [ERROR] org.infinispan.loaders.jdbc.JdbcUtil - ISPN008009: I/O
error while unmarshalling from stream
java.io.EOFException: Read past end of file
at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:126)
at
org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:263)
at
org.jboss.marshalling.SimpleDataInput.readUnsignedByte(SimpleDataInput.java:224)
at
org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1182)
at
org.infinispan.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:113)
at
org.infinispan.marshall.VersionAwareMarshaller.startObjectInput(VersionAwareMarshaller.java:156)
at
org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:112)
at
org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:104)
at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:88)
at E04.main(E04.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.inubit.ibis.configuration.Bootstrap.main(Bootstrap.java:66)
org.infinispan.loaders.CacheLoaderException: I/O error while unmarshalling from stream
at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:91)
at E04.main(E04.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.inubit.ibis.configuration.Bootstrap.main(Bootstrap.java:66)
Caused by: java.io.EOFException: Read past end of file
at org.jboss.marshalling.SimpleDataInput.eofOnRead(SimpleDataInput.java:126)
at
org.jboss.marshalling.SimpleDataInput.readUnsignedByteDirect(SimpleDataInput.java:263)
at
org.jboss.marshalling.SimpleDataInput.readUnsignedByte(SimpleDataInput.java:224)
at
org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1182)
at
org.infinispan.marshall.jboss.AbstractJBossMarshaller.startObjectInput(AbstractJBossMarshaller.java:113)
at
org.infinispan.marshall.VersionAwareMarshaller.startObjectInput(VersionAwareMarshaller.java:156)
at
org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:112)
at
org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:104)
at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:88)
... 6 more
Solution:
In AbstractMarshaller.objectFromInputStream is assumed, that the available() method from
the incoming InputStream returns the size of data.
But this is optional, so the InputStream from the oracle driver returns 0. So
implementation of objectFromInputStream must be changed to avoid usage of available().
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira