X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FSerialUtils.java;h=706d579970f9456fd430d4ae2020185aa8c7ed24;hb=a359464fcf59af8abc6f69ae0e88e42adc6018df;hp=114f80b2576a57a08177d944adfe755da2665544;hpb=949445eeaa6bc10572cc7bdc916de802f9ef817d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/serial/SerialUtils.java b/src/be/nikiroo/utils/serial/SerialUtils.java index 114f80b..706d579 100644 --- a/src/be/nikiroo/utils/serial/SerialUtils.java +++ b/src/be/nikiroo/utils/serial/SerialUtils.java @@ -66,8 +66,8 @@ public class SerialUtils { if (!SerialUtils.encode(builder, item)) { try { // use ZIP: if not - builder.append(new Exporter().append(item) - .toString(true)); + new Exporter().append(item).appendTo(builder, + true, false); } catch (NotSerializableException e) { throw new UnknownFormatConversionException(e .getMessage()); @@ -173,7 +173,6 @@ public class SerialUtils { throws ClassNotFoundException, NoSuchMethodException { String desc = null; - try { Class clazz = getClass(type); String className = clazz.getName(); @@ -209,8 +208,18 @@ public class SerialUtils { desc += end; // - ctor = clazz.getDeclaredConstructor(classes - .toArray(new Class[] {})); + try { + ctor = clazz.getDeclaredConstructor(classes + .toArray(new Class[] {})); + } catch (NoSuchMethodException nsme) { + // TODO: it seems e do not always need a parameter for each + // level, so we currently try "ALL" levels or "FIRST" level + // only -> we should check the actual rule and use it + ctor = clazz.getDeclaredConstructor(classes.get(0)); + Object firstParent = args.get(0); + args.clear(); + args.add(firstParent); + } desc = null; } else { ctor = clazz.getDeclaredConstructor();