Skip to content

Commit 9e461bd

Browse files
Copilotriccardobl
andcommitted
Fix list serialization for Double, Short, and Byte types
Add missing TYPE_DOUBLE, TYPE_SHORT, and TYPE_BYTE cases to readList method in UserData.java. These types were already handled in writeList but not in readList, causing deserialization to fail for lists containing these types. Also enable testLists in JmeExporterTest to verify the fix. Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
1 parent d02e570 commit 9e461bd

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

jme3-core/src/main/java/com/jme3/scene/UserData.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@ private List<?> readList(InputCapsule ic, String listName) throws IOException {
355355
}
356356
list.add(map);
357357
break;
358+
case TYPE_DOUBLE:
359+
list.add(ic.readDouble(listName + "v" + i, 0.));
360+
break;
361+
case TYPE_SHORT:
362+
list.add(ic.readShort(listName + "v" + i, (short)0));
363+
break;
364+
case TYPE_BYTE:
365+
list.add(ic.readByte(listName + "v" + i, (byte)0));
366+
break;
358367
default:
359368
throw new UnsupportedOperationException("Unknown type of stored data in a list: " + type);
360369
}

jme3-plugins/src/test/java/com/jme3/export/JmeExporterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void testSaveWithNullParent() throws IOException {
139139
public void testExporterConsistency() {
140140
//
141141
final boolean testXML = true;
142-
final boolean testLists = false;
142+
final boolean testLists = true;
143143
final boolean testMaps = true;
144144
final boolean printXML = false;
145145

0 commit comments

Comments
 (0)