diff --git a/js-test/source/java/ch/systemsx/cisd/openbis/jstest/service/V3ApiDtoTestService.java b/js-test/source/java/ch/systemsx/cisd/openbis/jstest/service/V3ApiDtoTestService.java index 174e1b4db2112c2c6295acece965d6c5268c036e..43eb04e0820aec8a30f56cae51142a91c96bd95b 100644 --- a/js-test/source/java/ch/systemsx/cisd/openbis/jstest/service/V3ApiDtoTestService.java +++ b/js-test/source/java/ch/systemsx/cisd/openbis/jstest/service/V3ApiDtoTestService.java @@ -38,6 +38,8 @@ import ch.ethz.sis.openbis.generic.server.sharedapi.v3.json.GenericObjectMapper; */ public class V3ApiDtoTestService implements ICustomASServiceExecutor { + private static final String PACKAGE_PREFIX = "ch.ethz.sis."; + public V3ApiDtoTestService(Properties properties) { } @@ -49,7 +51,19 @@ public class V3ApiDtoTestService implements ICustomASServiceExecutor System.out.println("PARAMETERS:"); Object obj = parameters.get("object"); boolean echo = parameters.containsKey("echo"); - System.out.println("echo: " + echo + ", object: " + obj + " (" + obj.getClass().getName() + ")"); + String name = obj.getClass().getName(); + System.out.println("echo: " + echo + ", object: " + obj + " (" + name + ")"); + if (name.startsWith(PACKAGE_PREFIX) == false) + { + if (name.startsWith("java.") && name.endsWith("Map")) + { + throw new IllegalArgumentException("Map class detected (" + name + "). This is a hint " + + "that no appropirated class found for deserialization. " + + "This is most probably caused by missing default constructor. Object: " + obj); + } + throw new IllegalArgumentException("Fully qualified class named doesn't start with '" + PACKAGE_PREFIX + + "': " + name + ". Object: " + obj); + } return echo ? obj : populate(obj); }