我在使用Twig(见下文)尝试加载时在本地开发模式中看到异常,我们在Live GAE中看不到。
我的同事也没有看到它,但我们有相同的开发设置 (虽然他在Mac上运行)
它失败的项目是ArrayList<ContactStatus>
ContactStatus
是一个简单的枚举(见下文),这是模型
声明
List<ContactStatus> contactStatuses = new ArrayList<ContactStatus>();
据我所知,这应该只是开箱即用?
不需要@Child
注释等吗? (确实添加@Embedded
似乎
因为问题35:http://code.google.com/p/twig-persist/issues/detail?id=35)
当我运行调试会话时,这似乎失败了因为ArrayList
没有实现Comparable
(因为Enum
总是这样做)
我们做错了什么?!
版本
枚举
public enum ContactStatus implements IsSerializable, Serializable {
Public, Secret, Blocked, Ignored;
}
我们在开发模式中看到的异常
java.lang.IllegalArgumentException: Cannot compare [SimpleProperty value=[Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored] path=contactStatuses indexed=false] with [SimpleProperty value=[Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Blocked, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored, Ignored] path=contactStatuses indexed=false]
at com.google.code.twig.util.PropertyComparator.compare(PropertyComparator.java:23)
at com.google.code.twig.util.PropertyComparator.compare(PropertyComparator.java:7)
at java.util.TreeMap.compare(TreeMap.java:1188)
at java.util.TreeMap.put(TreeMap.java:531)
at java.util.TreeSet.add(TreeSet.java:255)
at java.util.AbstractCollection.addAll(AbstractCollection.java:334)
at java.util.TreeSet.addAll(TreeSet.java:312)
at com.google.code.twig.standard.StandardDecodeCommand.entityToInstance(StandardDecodeCommand.java:60)
at com.google.code.twig.standard.StandardDecodeCommand.keyToInstance(StandardDecodeCommand.java:127)
at com.google.code.twig.standard.StandardSingleTypedLoadCommand.keyToInstance(StandardSingleTypedLoadCommand.java:9)
at com.google.code.twig.standard.StandardSingleTypedLoadCommand.now(StandardSingleTypedLoadCommand.java:34)
at com.google.code.twig.standard.TranslatorObjectDatastore.load(TranslatorObjectDatastore.java:202)
at com.recruitmentlink.server.persistence.twig.TwigProfileImpl.getExistingCandidate(TwigProfileImpl.java:92)
答案 0 :(得分:3)
这是John Patterson关于该问题的一个(超级快速)回复以及相关代码“修复”,它可以抑制这种不必要的“异常”
http://groups.google.com/group/twig-persist/browse_frm/thread/81b7d913a2ad37cc#
该问题仅影响使用Java 7的人。
由于GAE部署正在运行Java 6,因此我们没有看到实时问题。