Jian Li
Committed by Charles Chan

Not allow to assign values to appId and cookie at the same time

With current implementation, flow id can be either assigned by
fromApp method or withCookie method. This misleads the end-user
to properly instantiate a new flow rule. This commit restricts the
flow id assignment which does not allow to assign cookie and
appId at the same time.

Change-Id: I8d7e27517c7ef636d427c3d8b8f9cc267fcb0702
...@@ -364,7 +364,7 @@ public class DefaultFlowRule implements FlowRule { ...@@ -364,7 +364,7 @@ public class DefaultFlowRule implements FlowRule {
364 364
365 @Override 365 @Override
366 public FlowRule build() { 366 public FlowRule build() {
367 - checkArgument(flowId != null || appId != null, "Either an application" + 367 + checkArgument((flowId != null) ^ (appId != null), "Either an application" +
368 " id or a cookie must be supplied"); 368 " id or a cookie must be supplied");
369 checkNotNull(selector, "Traffic selector cannot be null"); 369 checkNotNull(selector, "Traffic selector cannot be null");
370 checkArgument(timeout != null || permanent != null, "Must either have " + 370 checkArgument(timeout != null || permanent != null, "Must either have " +
......