Skip to content

Commit 00cd195

Browse files
authored
Merge pull request #203 from splunk/Release/1.9.3
Release/1.9.3
2 parents 2452ea6 + 4bd1c31 commit 00cd195

File tree

10 files changed

+51
-23
lines changed

10 files changed

+51
-23
lines changed

CHANGELOG.md

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

3+
## Version 1.9.3
4+
5+
### Minor Changes
6+
* Re-fetch logic for instancetype and version fields if not set within Service instance to avoid NPE (GitHub PR [#202](https://github.com/splunk/splunk-sdk-java/pull/202))
7+
* Check for local IP as alternative to _localhost_ within HostnameVerifier, addressing issue with certain local workflows
8+
39
## Version 1.9.2
410

511
### New Features and APIs

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Java SDK Test](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml)
22
# The Splunk Software Development Kit for Java
33

4-
#### Version 1.9.2
4+
#### Version 1.9.3
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.
@@ -75,7 +75,7 @@ To add the Splunk SDK for Java `.JAR` file as a dependency:
7575
<dependency>
7676
<groupId>com.splunk</groupId>
7777
<artifactId>splunk</artifactId>
78-
<version>1.9.2</version>
78+
<version>1.9.3</version>
7979
</dependency>
8080
</dependencies>
8181
```

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.9.2"
5+
declare -r version="1.9.3"
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 **target/splunk-1.9.2.jar**, **target/splunk-1.9.2-javadoc.jar**, and
13-
**target/splunk-1.9.2-sources.jar** to the **local**, **staging**, or **production**
12+
Deploy transmits **target/splunk-1.9.3.jar**, **target/splunk-1.9.3-javadoc.jar**, and
13+
**target/splunk-1.9.3-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.9.2/
25-
├── splunk-1.9.2-javadoc.jar
26-
├── splunk-1.9.2-javadoc.jar.md5
27-
├── splunk-1.9.2-javadoc.jar.sha1
28-
├── splunk-1.9.2-sources.jar
29-
├── splunk-1.9.2-sources.jar.md5
30-
├── splunk-1.9.2-sources.jar.sha1
31-
├── splunk-1.9.2.jar
32-
├── splunk-1.9.2.jar.md5
33-
├── splunk-1.9.2.jar.sha1
34-
├── splunk-1.9.2.pom
35-
├── splunk-1.9.2.pom.md5
36-
└── splunk-1.9.2.pom.sha1
24+
com/splunk/splunk/1.9.3/
25+
├── splunk-1.9.3-javadoc.jar
26+
├── splunk-1.9.3-javadoc.jar.md5
27+
├── splunk-1.9.3-javadoc.jar.sha1
28+
├── splunk-1.9.3-sources.jar
29+
├── splunk-1.9.3-sources.jar.md5
30+
├── splunk-1.9.3-sources.jar.sha1
31+
├── splunk-1.9.3.jar
32+
├── splunk-1.9.3.jar.md5
33+
├── splunk-1.9.3.jar.sha1
34+
├── splunk-1.9.3.pom
35+
├── splunk-1.9.3.pom.md5
36+
└── splunk-1.9.3.pom.sha1
3737

3838
Verify this structure prior to release.

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>com.splunk</groupId>
3939
<artifactId>splunk</artifactId>
40-
<version>1.9.2</version>
40+
<version>1.9.3</version>
4141
<scope>provided</scope>
4242
</dependency>
4343
<dependency>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77

88
<properties>
9-
<version.number>1.9.2</version.number>
9+
<version.number>1.9.3</version.number>
1010
<maven.resources.overwrite>true</maven.resources.overwrite>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<maven.compiler.source>8</maven.compiler.source>

splunk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<artifactId>splunk</artifactId>
8-
<version>1.9.2</version>
8+
<version>1.9.3</version>
99
<parent>
1010
<artifactId>splunk-sdk-java</artifactId>
1111
<groupId>com.splunk</groupId>

splunk/src/main/java/com/splunk/HttpService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ public class HttpService {
5151
private static String HTTPS_SCHEME = "https";
5252
private static String HTTP_SCHEME = "http";
5353
private static String HOSTNAME = "localhost";
54+
private static String HOSTIP = "127.0.0.1";
5455

5556
private static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() {
5657
public boolean verify(String s, SSLSession sslSession) {
57-
if (s.equals(HOSTNAME)) {
58+
if (s.equals(HOSTNAME) || s.equals(HOSTIP)) {
5859
return true;
5960
} else {
6061
HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
@@ -89,7 +90,7 @@ public boolean verify(String s, SSLSession sslSession) {
8990
private String prefix = null;
9091

9192
static Map<String, String> defaultHeader = new HashMap<String, String>() {{
92-
put("User-Agent", "splunk-sdk-java/1.9.2");
93+
put("User-Agent", "splunk-sdk-java/1.9.3");
9394
put("Accept", "*/*");
9495
}};
9596

splunk/src/main/java/com/splunk/Service.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,9 @@ public void setBearerToken(String value) {
13561356

13571357

13581358
public boolean enableV2SearchApi(){
1359+
if(null == this.instanceType){
1360+
this.instanceType = this.getInfo().getInstanceType();
1361+
}
13591362
if(this.instanceType.equalsIgnoreCase("cloud")) {
13601363
return versionIsAtLeast("9.0.2209");
13611364
}else{
@@ -1411,6 +1414,9 @@ boolean versionIsEarlierThan(String version) {
14111414
* or 1 if this version is greater than the given version.
14121415
*/
14131416
public int versionCompare(String otherVersion) {
1417+
if(null == this.version){
1418+
this.version = this.getInfo().getVersion();
1419+
}
14141420
String[] components1 = this.version.split("\\.");
14151421
String[] components2 = otherVersion.split("\\.");
14161422
int numComponents = Math.max(components1.length, components2.length);

splunk/src/test/java/com/splunk/ServiceTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,4 +735,19 @@ public void testEnableV2Api(){
735735
}
736736
}
737737

738+
/*
739+
Test when Service instance is created using token, it doesn't result in Null Pointer while accessing instanceType and version
740+
*/
741+
@Test
742+
public void testServiceWithTokenAuth(){
743+
Service newService = new Service(service.getHost());
744+
newService.setToken(service.getToken());
745+
try{
746+
newService.enableV2SearchApi();
747+
newService.versionCompare("9.0.2");
748+
}catch (Exception ex){
749+
Assert.assertNull(ex);
750+
}
751+
}
752+
738753
}

0 commit comments

Comments
 (0)