The array writing was not respecting the "limit" value, which caused exceptions when loading certain exported models.
Here is a diff:
Index: BinaryOutputCapsule.java
===================================================================
RCS file: /cvs/jme/src/com/jme/util/export/binary/BinaryOutputCapsule.java,v
retrieving revision 1.5
diff -d -u -r1.5 BinaryOutputCapsule.java
--- BinaryOutputCapsule.java 5 Oct 2007 22:42:40 -0000 1.5
+++ BinaryOutputCapsule.java 16 Dec 2007 22:12:38 -0000
@@ -13,8 +13,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -304,7 +304,7 @@
byte alias = cObj.nameFields.get(name).alias;
write(alias);
}
-
+
// XXX: The generation of aliases is limited to 256 possible values.
// If we run into classes with more than 256 fields, we need to expand this.
// But I mean, come on...
@@ -657,7 +657,7 @@
}
}
-
+
// Map<BinarySavable, BinarySavable>
protected void writeSavableMap(Map<? extends Savable, ? extends Savable> array) throws IOException {
@@ -678,11 +678,11 @@
return;
}
write(array.size());
-
+
// write String array for keys
String[] keys = array.keySet().toArray(new String[] {});
write(keys);
-
+
// write Savable array for values
Savable[] values = array.values().toArray(new Savable[] {});
write(values);
@@ -709,8 +709,8 @@
write(NULL_OBJECT);
return;
}
- value.clear();
- int length = value.capacity();
+ value.rewind();
+ int length = value.limit();
write(length);
for (int x = 0; x < length; x++) {
write(value.get());
@@ -725,8 +725,8 @@
write(NULL_OBJECT);
return;
}
- value.clear();
- int length = value.capacity();
+ value.rewind();
+ int length = value.limit();
write(length);
for (int x = 0; x < length; x++) {
write(value.get());
@@ -741,8 +741,8 @@
write(NULL_OBJECT);
return;
}
- value.clear();
- int length = value.capacity();
+ value.rewind();
+ int length = value.limit();
write(length);
for (int x = 0; x < length; x++) {
write(value.get());
@@ -757,8 +757,8 @@
write(NULL_OBJECT);
return;
}
- value.clear();
- int length = value.capacity();
+ value.rewind();
+ int length = value.limit();
write(length);
for (int x = 0; x < length; x++) {
write(value.get());