fix according to code review

This commit is contained in:
fjy 2013-11-07 15:52:34 -08:00
parent aeb411a3a3
commit bad1a7e9f8
1 changed files with 2 additions and 3 deletions

View File

@ -83,11 +83,10 @@ public class EventReceiverFirehoseFactory implements FirehoseFactory
config.getFirehoseIdPrefix(), config.getFirehoseIdPrefix(),
Preconditions.checkNotNull(firehoseId, "firehoseId") Preconditions.checkNotNull(firehoseId, "firehoseId")
); );
this.config = config;
} else { } else {
this.serviceName = Preconditions.checkNotNull(serviceName, "serviceName"); this.serviceName = Preconditions.checkNotNull(serviceName, "serviceName");
this.config = null;
} }
this.config = config;
this.bufferSize = bufferSize == null || bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize; this.bufferSize = bufferSize == null || bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize;
this.parser = Preconditions.checkNotNull(parser, "parser"); this.parser = Preconditions.checkNotNull(parser, "parser");
@ -122,7 +121,7 @@ public class EventReceiverFirehoseFactory implements FirehoseFactory
public String getFirehoseId() public String getFirehoseId()
{ {
if (config != null) { if (config != null) {
return serviceName.replaceFirst(config.getFirehoseIdPrefix(), ""); return serviceName.replaceFirst(String.format("%s:", config.getFirehoseIdPrefix()), "");
} }
return null; return null;