Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException from ConditionalEvaluator.evaluateEmpty #80

Open
dcrissman opened this issue Nov 13, 2014 · 2 comments
Open

ClassCastException from ConditionalEvaluator.evaluateEmpty #80

dcrissman opened this issue Nov 13, 2014 · 2 comments
Labels

Comments

@dcrissman
Copy link
Member

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
Copy link
Collaborator

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants