I'm trying to upgrade to JDK 1.7 due to what looks like a bug in the latest version of app engine plugin for Eclipse when trying to perform a URL fetch. A posting online indicated that the problem that I am experiencing with JDK 1.6 can be fixed by using the Oracle version of JDK 1.7, hence I have installed that, but now I experience the following problem with Twig. (Note: this problem is triggered from an ObjectDatastore.find() command):
Caused by: java.lang.IllegalArgumentException: Cannot compare with [SimpleProperty value=null path=phoneNbr indexed=false]
at com.google.code.twig.util.SimpleProperty.compareTo(SimpleProperty.java:110)
at com.google.code.twig.util.SimpleProperty.compareTo(SimpleProperty.java:6)
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:114)
at com.google.code.twig.standard.StandardDecodeCommand.keyToInstance(StandardDecodeCommand.java:205)
at com.google.code.twig.standard.StandardUntypedSingleLoadCommand.keyToInstance(StandardUntypedSingleLoadCommand.java:6)
at com.google.code.twig.standard.StandardUntypedSingleLoadCommand.now(StandardUntypedSingleLoadCommand.java:19)
at com.google.code.twig.standard.RelationTranslator.keyToInstance(RelationTranslator.java:131)
at com.google.code.twig.standard.ParentRelationTranslator.decode(ParentRelationTranslator.java:38)
at com.google.code.twig.translator.FieldTranslator.decodeField(FieldTranslator.java:158)
What is happening is that an entity property with a null value is being compared to itself. This line 99, path.compareTo(o.getPath()) to return 0. This causes the first else clause (line 104) to be skipped, leading to throw new IllegalArgumentException() at line 110.
Two observations:
1. line 106 - I think is in error (compares to itself. Should be? -- return compare((Comparable<?>) value, o.getValue());
2. It looks like some else clauses need to be added to test for value or o.value being null and returning the appropriate value from SimpleProperty.compareTo().
Any help with this would be appreciated. The code looks a bit inadequate, but I am surprised that this hasn't been seen before. Is no one using JDK 1.7?
Thanks,
Rick