fixed a serialization error introduced by yesterday changes

(sorry for the noise)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@789358 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2009-06-29 15:20:22 +00:00
parent c7beb702d8
commit 879518c341
3 changed files with 51 additions and 5 deletions

View File

@ -362,7 +362,7 @@ public abstract class AbstractStepInterpolator
/** {@inheritDoc} */
public abstract void readExternal(ObjectInput in)
throws IOException;
throws IOException, ClassNotFoundException;
/** Save the base state of the instance.
* This method performs step finalization if it has not been done

View File

@ -187,18 +187,64 @@ public class NordsieckStepInterpolator extends AbstractStepInterpolator {
@Override
public void writeExternal(final ObjectOutput out)
throws IOException {
// save the state of the base class
writeBaseExternal(out);
// save the local attributes
out.writeDouble(scalingH);
out.writeDouble(referenceTime);
final int n = (currentState == null) ? -1 : currentState.length;
if (scaled == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
for (int j = 0; j < n; ++j) {
out.writeDouble(scaled[j]);
}
}
if (nordsieck == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeObject(nordsieck);
}
}
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
throws IOException {
throws IOException, ClassNotFoundException {
// read the base class
final double t = readBaseExternal(in);
if ((scaled != null) && (nordsieck != null)) {
// read the local attributes
scalingH = in.readDouble();
referenceTime = in.readDouble();
final int n = (currentState == null) ? -1 : currentState.length;
final boolean hasScaled = in.readBoolean();
if (hasScaled) {
scaled = new double[n];
for (int j = 0; j < n; ++j) {
scaled[j] = in.readDouble();
}
} else {
scaled = null;
}
final boolean hasNordsieck = in.readBoolean();
if (hasNordsieck) {
nordsieck = (Array2DRowRealMatrix) in.readObject();
} else {
nordsieck = null;
}
if (hasScaled && hasNordsieck) {
// we can now set the interpolated time and state
setInterpolatedTime(t);
}

View File

@ -62,8 +62,8 @@ public class NordsieckStepInterpolatorTest {
oos.writeObject(handler);
}
assertTrue(bos.size () > 16000);
assertTrue(bos.size () < 17000);
assertTrue(bos.size () > 20000);
assertTrue(bos.size () < 25000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);