Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bugfix for preconditions in withColumnFamily in DefaultEntityManager.Builder #238

Merged
merged 1 commit into from

2 participants

@mosche

I assume the intention here was to prohibit multiple calls to withColumnFamily. However, Preconditions.checkState throws an IllegalStateException if the given expression is false...

moritz mack Fixing preconditions bug for withColumnFamily in the DefaultEntityMan…
…ager. Preconditions.checkState throws an exception if the expression is FALSE.
840cc9b
@elandau elandau merged commit 16a6989 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. Fixing preconditions bug for withColumnFamily in the DefaultEntityMan…

    moritz mack authored
    …ager. Preconditions.checkState throws an exception if the expression is FALSE.
This page is out of date. Refresh to see the latest.
View
5 astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/DefaultEntityManager.java
@@ -77,7 +77,7 @@ public Builder() {
* @param columnFamily column name type is fixed to String/UTF8
*/
public Builder<T, K> withColumnFamily(ColumnFamily<K, String> columnFamily) {
- Preconditions.checkState(this.columnFamilyName != null || columnFamily != null , "withColumnFamily called multiple times");
+ Preconditions.checkState(this.columnFamilyName == null && this.columnFamily == null , "withColumnFamily called multiple times");
Preconditions.checkNotNull(columnFamily);
this.columnFamily = columnFamily;
return this;
@@ -88,7 +88,8 @@ public Builder() {
* @param columnFamilyName Name of column family to use.
*/
public Builder<T, K> withColumnFamily(String columnFamilyName) {
- Preconditions.checkState(this.columnFamilyName != null || columnFamily != null , "withColumnFamily called multiple times");
+ Preconditions.checkState(this.columnFamilyName == null && columnFamily == null , "withColumnFamily called multiple times");
+ Preconditions.checkNotNull(columnFamilyName);
this.columnFamilyName = columnFamilyName;
return this;
}
Something went wrong with that request. Please try again.