Skip to content

Commit

Permalink
Added check for empty string along with null for channel
Browse files Browse the repository at this point in the history
- Also added comments for channel and type
  • Loading branch information
dan1 committed May 31, 2018
1 parent 51e7799 commit 9af6a32
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public enum SendMode
* @param maxEventsBatchCount max number of events in a batch
* @param maxEventsBatchSize max size of batch
* @param metadata events metadata
* @param channel
* @param type
* @param channel unique GUID for the client to send raw events to the server
* @param type event data type
*/
public HttpEventCollectorSender(
final String Url, final String token, final String channel, final String type,
Expand Down Expand Up @@ -387,7 +387,7 @@ public void postEvents(final List<HttpEventCollectorEventInfo> events,
httpPost.setHeader(
AuthorizationHeaderTag,
String.format(AuthorizationHeaderScheme, token));
if ("Raw".equalsIgnoreCase(type) && channel != null) {
if ("Raw".equalsIgnoreCase(type) && channel != null && !channel.trim().equals("")) {
httpPost.setHeader(SPLUNKREQUESTCHANNELTag, channel);
}
StringEntity entity = new StringEntity(eventsBatchString.toString(), encoding);
Expand Down

0 comments on commit 9af6a32

Please sign in to comment.