Skip to content

Commit be247c1

Browse files
author
Shakeel Mohamed
committed
Release 1.6.1
2 parents 34e5104 + 56bbb1c commit be247c1

8 files changed

Lines changed: 55 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Splunk SDK for Java Changelog
22

3+
## Version 1.6.1
4+
5+
### Bug Fixes
6+
7+
* Fix authentication issues when the Splunk `Set-Cookie` header is not the first one.
8+
39
## Version 1.6.0
410

511
### New features and APIs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build Status](https://travis-ci.org/splunk/splunk-sdk-java.svg?branch=master)](https://travis-ci.org/splunk/splunk-sdk-java)
22
# The Splunk Software Development Kit for Java
33

4-
#### Version 1.6.0
4+
#### Version 1.6.1
55

66
The Splunk Software Development Kit (SDK) for Java contains library code and
77
examples designed to enable developers to build applications using Splunk.

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<project name="splunk-sdk-java" basedir="." default="dist" xmlns:jacoco="antlib:org.jacoco.ant"
2020
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="antlib:org.jacoco.ant ">
21-
<property name="version.number" value="1.6.0"/>
21+
<property name="version.number" value="1.6.1"/>
2222

2323
<!-- Paths within the repository that are referenced
2424
multiple times. -->

deploy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare -r scriptDirectory="$(dirname $(readlink -e $0))"
44
declare -r scriptName="$(basename $0)"
5-
declare -r version="1.6.0"
5+
declare -r version="1.6.1"
66

77
if [[ $# -ne 1 ]]; then
88
echo 1>&2 "Usage: ${scriptName} {local|staging||production}"

deploy.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ deploy \<repository-name>
99

1010
##DESCRIPTION
1111

12-
Deploy transmits **dist/splunk-1.6.0.jar**, **dist/splunk-1.6.0-javadoc.jar**, and
13-
**dist/splunk-1.6.0-sources.jar** to the **local**, **staging**, or **production**
12+
Deploy transmits **dist/splunk-1.6.1.jar**, **dist/splunk-1.6.1-javadoc.jar**, and
13+
**dist/splunk-1.6.1-sources.jar** to the **local**, **staging**, or **production**
1414
maven repository. Repository names are mapped to locations as follows.
1515

1616
| repository-name | location |
@@ -21,18 +21,18 @@ maven repository. Repository names are mapped to locations as follows.
2121

2222
After deployment you should find this tree structure at the location of your repository
2323

24-
com/splunk/splunk/1.6.0/
25-
├── splunk-1.6.0-javadoc.jar
26-
├── splunk-1.6.0-javadoc.jar.md5
27-
├── splunk-1.6.0-javadoc.jar.sha1
28-
├── splunk-1.6.0-sources.jar
29-
├── splunk-1.6.0-sources.jar.md5
30-
├── splunk-1.6.0-sources.jar.sha1
31-
├── splunk-1.6.0.jar
32-
├── splunk-1.6.0.jar.md5
33-
├── splunk-1.6.0.jar.sha1
34-
├── splunk-1.6.0.pom
35-
├── splunk-1.6.0.pom.md5
36-
└── splunk-1.6.0.pom.sha1
24+
com/splunk/splunk/1.6.1/
25+
├── splunk-1.6.1-javadoc.jar
26+
├── splunk-1.6.1-javadoc.jar.md5
27+
├── splunk-1.6.1-javadoc.jar.sha1
28+
├── splunk-1.6.1-sources.jar
29+
├── splunk-1.6.1-sources.jar.md5
30+
├── splunk-1.6.1-sources.jar.sha1
31+
├── splunk-1.6.1.jar
32+
├── splunk-1.6.1.jar.md5
33+
├── splunk-1.6.1.jar.sha1
34+
├── splunk-1.6.1.pom
35+
├── splunk-1.6.1.pom.md5
36+
└── splunk-1.6.1.pom.sha1
3737

3838
Verify this structure prior to release.

splunk/com/splunk/HttpService.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.net.*;
2525
import java.security.cert.X509Certificate;
2626
import java.util.HashMap;
27+
import java.util.List;
2728
import java.util.Map;
2829
import java.util.Map.Entry;
2930

@@ -72,7 +73,7 @@ public boolean verify(String s, SSLSession sslSession) {
7273
private String prefix = null;
7374

7475
static Map<String, String> defaultHeader = new HashMap<String, String>() {{
75-
put("User-Agent", "splunk-sdk-java/1.6.0");
76+
put("User-Agent", "splunk-sdk-java/1.6.1");
7677
put("Accept", "*/*");
7778
}};
7879

@@ -320,7 +321,7 @@ public void setReadTimeout(Integer readTimeout) {
320321
this.readTimeout = readTimeout;
321322
}
322323

323-
/**
324+
/**
324325
* Issues a POST request against the service using a given path.
325326
*
326327
* @param path The request path.
@@ -476,9 +477,15 @@ public ResponseMessage send(String path, RequestMessage request) {
476477
} catch (IOException e) {
477478
assert (false);
478479
}
479-
480+
480481
// Add cookies to cookie Store
481-
cookieStore.add(cn.getHeaderField("Set-Cookie"));
482+
Map<String, List<String>> headers = cn.getHeaderFields();
483+
if (headers.containsKey("Set-Cookie")) {
484+
for (String cookieHeader : headers.get("Set-Cookie")) {
485+
if (cookieHeader != null && cookieHeader.length() > 0)
486+
cookieStore.add(cookieHeader);
487+
}
488+
}
482489

483490
ResponseMessage response = new ResponseMessage(status, input);
484491

tests/com/splunk/CookieTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616

1717
package com.splunk;
1818

19+
import java.util.HashMap;
20+
import java.util.Map;
21+
1922
import org.junit.Assert;
20-
import org.junit.Before;
2123
import org.junit.Assume;
24+
import org.junit.Before;
2225
import org.junit.Test;
23-
import java.util.HashMap;
24-
import java.util.Map;
2526

2627
public class CookieTest extends SDKTestCase {
2728

@@ -123,6 +124,21 @@ public void testLoginWithMultipleCookies() {
123124
s.getSettings().refresh();
124125
}
125126

127+
@Test
128+
public void testLoginWithMultipleInvalidCookies() {
129+
String validCookie = service.stringifyCookies();
130+
131+
Map<String, Object> args = getStandardArgs();
132+
133+
Service s = new Service(args);
134+
135+
s.addCookie("bad=cookie");
136+
s.addCookie(validCookie);
137+
s.addCookie("another_bad=cookie");
138+
139+
s.getSettings().refresh();
140+
}
141+
126142
@Test
127143
public void testLoginWithMultipleCookiesReversed() {
128144
String validCookie = service.stringifyCookies();

tests/com/splunk/ServiceTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,7 @@ public void testHandleErrorsReturnedAsJson() {
650650
try {
651651
service.export("notasearchcommand", exportArgs);
652652
} catch (Exception e) {
653-
Assert.assertEquals(
654-
"HTTP 400 -- {\"messages\":[{\"type\":\"FATAL\",\"text\":" +
655-
"\"Unknown search command 'notasearchcommand'.\"}]}",
656-
e.getMessage()
657-
);
653+
Assert.assertTrue(e.getMessage().contains("Unknown search command"));
658654
return;
659655
}
660656
Assert.fail();

0 commit comments

Comments
 (0)