lightblue-platform / lightblue-rdbms

GNU General Public License v3.0
1 stars 6 forks source link

ClassCastException from ConditionalEvaluator.evaluateEmpty #80

Open dcrissman opened 10 years ago

dcrissman commented 10 years ago
public static boolean evaluateEmpty(IfFieldEmpty fe, RDBMSContext rdbmsContext) {
    return ((Collection)fe.getField()).isEmpty();
}

In the above code snippet, com.redhat.lightblue.util.Path is being cast to a java.util.Collection, which it is not, causing a ClassCastException.

luan-cestari commented 10 years ago

The correct implementation would get the value from the data returned from SQL database and check if that is empty. For example that value could be a string or a list, both can be empty, but doesn't have an common interface, so it would need instanceof

dcrissman commented 9 years ago

For now, I slapped the Ignore annotation on the failing tests in ConditionalEvaluatorTest. These annotations should be removed when addressed. testEvaluateEmpty_True testEvaluateEmpty_False