You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/07/01 20:47:51 UTC
DO NOT REPLY [Bug 21240] New: -
Axis Types that extend BigInteger are not serializable
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21240>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21240
Axis Types that extend BigInteger are not serializable
Summary: Axis Types that extend BigInteger are not serializable
Product: Axis
Version: 1.1
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization/Deserialization
AssignedTo: axis-dev@ws.apache.org
ReportedBy: mbaker@erac.com
The Axis types that extend BigInteger (NonNegativeInteger, PositiveInteger,
NonPositiveInteger and NegativeInteger) are not serializable. A stack trace of
this problem follows:
Exception in thread "main" java.lang.NullPointerException
at java.math.BigInteger.readObject(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectInputStream.invokeObjectReader(Unknown Source)
at java.io.ObjectInputStream.inputObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at MySerial2.main(MySerial2.java:35)
I tested this using a very simple java client:
import java.net.URL;
import java.io.ObjectOutputStream;
import java.io.ByteArrayOutputStream;
import org.apache.axis.types.NonNegativeInteger;
import java.util.Calendar;
import java.io.ObjectInputStream;
import java.io.ByteArrayInputStream;
import java.io.*;
import java.math.*;
public class MySerial2 implements java.io.Serializable
{
public static void main(String args[]) throws Exception {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(new NonNegativeInteger("1"));
baos.close();
oos.close();
byte[] myBytes = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(myBytes);
ObjectInputStream ois = new ObjectInputStream(bais);
Object myObj = ois.readObject();
if (myObj instanceof NonNegativeInteger)
{
NonNegativeInteger nni = (NonNegativeInteger) myObj;
System.out.println("Successful");
}
}
catch (IOException e) {
e.printStackTrace();
}
}
}
It appears to me that the BigInteger has private methods for serialization and
that the Axis types don't have access to them.