From 81519542e80bc7aeddbf5757a9f847ff798d8fea Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Thu, 20 Dec 2018 03:16:21 +0100 Subject: [PATCH] Disable error in migration when field is not found This error was useful when developing the system. Now however, it throws whenever a field is removed and the removal is not dealt with in a migrator. That we do not want. --- .../massivecore/store/migrator/MigratorUtil.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/com/massivecraft/massivecore/store/migrator/MigratorUtil.java b/src/com/massivecraft/massivecore/store/migrator/MigratorUtil.java index 47fde583..7e08dc4e 100644 --- a/src/com/massivecraft/massivecore/store/migrator/MigratorUtil.java +++ b/src/com/massivecraft/massivecore/store/migrator/MigratorUtil.java @@ -101,7 +101,7 @@ public class MigratorUtil } // GET - public static int getTargetVersion(Class entityClass) + public static int getTargetVersion(Class entityClass) { if (!targetVersions.containsKey(entityClass)) { @@ -347,16 +347,19 @@ public class MigratorUtil Class superClass = ReflectionUtil.getSuperclassDeclaringField(entityClass, true, name); // Try find field if it has a different serialisation name - if (superClass == null) - { + if (superClass == null) { Field field = tryFindField(entityClass, name); - if (field != null) - { + if (field != null) { name = field.getName(); superClass = entityClass; } } - if (superClass == null) throw new RuntimeException(type.getTypeName() + " : " + name); + if (superClass == null) + { + // Probably the field doesn't exist anymore, so this error is disabled. + //throw new RuntimeException(type.getTypeName() + " : " + name); + continue; + } Type elementType = ReflectionUtil.getField(superClass, name).getGenericType(); try {