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 di...@apache.org on 2003/07/02 20:50:47 UTC
cvs commit: xml-axis/java/src/org/apache/axis/types NegativeInteger.java NonNegativeInteger.java NonPositiveInteger.java PositiveInteger.java
dims 2003/07/02 11:50:46
Modified: java/src/org/apache/axis/types NegativeInteger.java
NonNegativeInteger.java NonPositiveInteger.java
PositiveInteger.java
Log:
Fix for Bug 21240 - Axis Types that extend BigInteger are not serializable
Revision Changes Path
1.6 +19 -0 xml-axis/java/src/org/apache/axis/types/NegativeInteger.java
Index: NegativeInteger.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NegativeInteger.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NegativeInteger.java 22 Apr 2003 19:36:00 -0000 1.5
+++ NegativeInteger.java 2 Jul 2003 18:50:46 -0000 1.6
@@ -58,6 +58,7 @@
import java.math.BigInteger;
import java.util.Random;
+import java.io.ObjectStreamException;
/**
* Custom class for supporting primitive XSD data type negativeinteger
@@ -115,4 +116,22 @@
}
} // checkValidity
+ /**
+ * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html
+ * @return BigIntegerRep
+ * @throws java.io.ObjectStreamException
+ */
+ public Object writeReplace() throws ObjectStreamException {
+ return new BigIntegerRep(toByteArray());
+ }
+
+ protected static class BigIntegerRep implements java.io.Serializable {
+ private byte[] array;
+ protected BigIntegerRep(byte[] array) {
+ this.array = array;
+ }
+ protected Object readResolve() throws java.io.ObjectStreamException {
+ return new NegativeInteger(array);
+ }
+ }
} // class NonNegativeInteger
1.9 +20 -1 xml-axis/java/src/org/apache/axis/types/NonNegativeInteger.java
Index: NonNegativeInteger.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NonNegativeInteger.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NonNegativeInteger.java 22 Apr 2003 19:36:00 -0000 1.8
+++ NonNegativeInteger.java 2 Jul 2003 18:50:46 -0000 1.9
@@ -56,6 +56,7 @@
import org.apache.axis.utils.Messages;
+import java.io.ObjectStreamException;
import java.math.BigInteger;
import java.util.Random;
@@ -108,5 +109,23 @@
+ ": " + this);
}
} // checkValidity
-
+
+ /**
+ * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html
+ * @return BigIntegerRep
+ * @throws ObjectStreamException
+ */
+ public Object writeReplace() throws ObjectStreamException {
+ return new BigIntegerRep(toByteArray());
+ }
+
+ protected static class BigIntegerRep implements java.io.Serializable {
+ private byte[] array;
+ protected BigIntegerRep(byte[] array) {
+ this.array = array;
+ }
+ protected Object readResolve() throws java.io.ObjectStreamException {
+ return new NonNegativeInteger(array);
+ }
+ }
} // class NonNegativeInteger
1.6 +19 -0 xml-axis/java/src/org/apache/axis/types/NonPositiveInteger.java
Index: NonPositiveInteger.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NonPositiveInteger.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NonPositiveInteger.java 22 Apr 2003 19:36:00 -0000 1.5
+++ NonPositiveInteger.java 2 Jul 2003 18:50:46 -0000 1.6
@@ -58,6 +58,7 @@
import java.math.BigInteger;
import java.util.Random;
+import java.io.ObjectStreamException;
/**
* Custom class for supporting primitive XSD data type nonPositiveInteger
@@ -114,4 +115,22 @@
}
} // checkValidity
+ /**
+ * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html
+ * @return BigIntegerRep
+ * @throws java.io.ObjectStreamException
+ */
+ public Object writeReplace() throws ObjectStreamException {
+ return new BigIntegerRep(toByteArray());
+ }
+
+ protected static class BigIntegerRep implements java.io.Serializable {
+ private byte[] array;
+ protected BigIntegerRep(byte[] array) {
+ this.array = array;
+ }
+ protected Object readResolve() throws java.io.ObjectStreamException {
+ return new NonPositiveInteger(array);
+ }
+ }
} // class NonPositiveInteger
1.6 +19 -0 xml-axis/java/src/org/apache/axis/types/PositiveInteger.java
Index: PositiveInteger.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/PositiveInteger.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PositiveInteger.java 22 Apr 2003 19:36:00 -0000 1.5
+++ PositiveInteger.java 2 Jul 2003 18:50:46 -0000 1.6
@@ -58,6 +58,7 @@
import java.math.BigInteger;
import java.util.Random;
+import java.io.ObjectStreamException;
/**
* Custom class for supporting primitive XSD data type positiveInteger
@@ -113,4 +114,22 @@
}
} // checkValidity
+ /**
+ * Work-around for http://developer.java.sun.com/developer/bugParade/bugs/4378370.html
+ * @return BigIntegerRep
+ * @throws java.io.ObjectStreamException
+ */
+ public Object writeReplace() throws ObjectStreamException {
+ return new BigIntegerRep(toByteArray());
+ }
+
+ protected static class BigIntegerRep implements java.io.Serializable {
+ private byte[] array;
+ protected BigIntegerRep(byte[] array) {
+ this.array = array;
+ }
+ protected Object readResolve() throws java.io.ObjectStreamException {
+ return new PositiveInteger(array);
+ }
+ }
} // class NonNegativeInteger