(WCM-869) Fixing compareTo method to avoid exceptions in case of Java 7
usage.