INTEXT-23 - Incorrect enum comparison

This commit is contained in:
Jarred Li
2012-10-02 22:17:17 +08:00
committed by Gunnar Hillert
parent 47c347f36a
commit 987a35efae
26 changed files with 42 additions and 52 deletions

View File

@@ -27,15 +27,5 @@ package org.springframework.integration.splunk.support;
*
*/
public enum IngestType {
stream("stream"), tcp("tcp"), submit("submit");
private String type;
IngestType(String ingestType) {
this.type = ingestType;
}
public String getIngestType() {
return type;
}
STREAM, TCP, SUBMIT;
}

View File

@@ -29,5 +29,5 @@ package org.springframework.integration.splunk.support;
*
*/
public enum SearchMode {
blocking, normal, realtime, export, saved;
BLOCKING, NORMAL, REALTIME, EXPORT, SAVEDSEARCH;
}

View File

@@ -179,19 +179,19 @@ public class SplunkDataReader implements DataReader, InitializingBean {
public List<SplunkData> search() throws Exception {
logger.debug("mode:" + mode);
switch (mode) {
case saved: {
case SAVEDSEARCH: {
return savedSearch();
}
case blocking: {
case BLOCKING: {
return blockingSearch();
}
case normal: {
case NORMAL: {
return nonBlockingSearch();
}
case export: {
case EXPORT: {
return exportSearch();
}
case realtime: {
case REALTIME: {
return realtimeSearch();
}
}

View File

@@ -54,7 +54,7 @@ public class SplunkDataWriter implements DataWriter, InitializingBean {
private String index;
private IngestType ingest = IngestType.stream; //tcp, stream, submit
private IngestType ingest = IngestType.STREAM; //tcp, stream, submit
private int tcpPort;
@@ -101,8 +101,8 @@ public class SplunkDataWriter implements DataWriter, InitializingBean {
receiver = service.getReceiver();
}
if ((ingest.equals(IngestType.stream) || ingest.equals(IngestType.tcp))) {
if (ingest.equals("stream")) {
if ((ingest.equals(IngestType.STREAM) || ingest.equals(IngestType.TCP))) {
if (ingest.equals(IngestType.STREAM)) {
if (indexObject != null)
socket = indexObject.attach(args);
else
@@ -115,7 +115,7 @@ public class SplunkDataWriter implements DataWriter, InitializingBean {
writer = new OutputStreamWriter(ostream, "UTF8");
}
if ((ingest.equals(IngestType.stream) || ingest.equals(IngestType.tcp))) {
if ((ingest.equals(IngestType.STREAM) || ingest.equals(IngestType.TCP))) {
writer.write(data.toString());
writer.flush();
writer.close();