Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Splunk Enterprise SDK for Java Changelog

## Version 1.9.3

### Minor Changes
* 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))
* Check for local IP as alternative to _localhost_ within HostnameVerifier, addressing issue with certain local workflows

## Version 1.9.2

### New Features and APIs
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![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)
# The Splunk Software Development Kit for Java

#### Version 1.9.2
#### Version 1.9.3

The Splunk Software Development Kit (SDK) for Java contains library code and
examples designed to enable developers to build applications using Splunk.
Expand Down Expand Up @@ -75,7 +75,7 @@ To add the Splunk SDK for Java `.JAR` file as a dependency:
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.9.2</version>
<version>1.9.3</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare -r scriptDirectory="$(dirname $(readlink -e $0))"
declare -r scriptName="$(basename $0)"
declare -r version="1.9.2"
declare -r version="1.9.3"

if [[ $# -ne 1 ]]; then
echo 1>&2 "Usage: ${scriptName} {local|staging||production}"
Expand Down
30 changes: 15 additions & 15 deletions deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ deploy \<repository-name>

##DESCRIPTION

Deploy transmits **target/splunk-1.9.2.jar**, **target/splunk-1.9.2-javadoc.jar**, and
**target/splunk-1.9.2-sources.jar** to the **local**, **staging**, or **production**
Deploy transmits **target/splunk-1.9.3.jar**, **target/splunk-1.9.3-javadoc.jar**, and
**target/splunk-1.9.3-sources.jar** to the **local**, **staging**, or **production**
maven repository. Repository names are mapped to locations as follows.

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

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

com/splunk/splunk/1.9.2/
├── splunk-1.9.2-javadoc.jar
├── splunk-1.9.2-javadoc.jar.md5
├── splunk-1.9.2-javadoc.jar.sha1
├── splunk-1.9.2-sources.jar
├── splunk-1.9.2-sources.jar.md5
├── splunk-1.9.2-sources.jar.sha1
├── splunk-1.9.2.jar
├── splunk-1.9.2.jar.md5
├── splunk-1.9.2.jar.sha1
├── splunk-1.9.2.pom
├── splunk-1.9.2.pom.md5
└── splunk-1.9.2.pom.sha1
com/splunk/splunk/1.9.3/
├── splunk-1.9.3-javadoc.jar
├── splunk-1.9.3-javadoc.jar.md5
├── splunk-1.9.3-javadoc.jar.sha1
├── splunk-1.9.3-sources.jar
├── splunk-1.9.3-sources.jar.md5
├── splunk-1.9.3-sources.jar.sha1
├── splunk-1.9.3.jar
├── splunk-1.9.3.jar.md5
├── splunk-1.9.3.jar.sha1
├── splunk-1.9.3.pom
├── splunk-1.9.3.pom.md5
└── splunk-1.9.3.pom.sha1

Verify this structure prior to release.
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.9.2</version>
<version>1.9.3</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<version.number>1.9.2</version.number>
<version.number>1.9.3</version.number>
<maven.resources.overwrite>true</maven.resources.overwrite>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion splunk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>splunk</artifactId>
<version>1.9.2</version>
<version>1.9.3</version>
<parent>
<artifactId>splunk-sdk-java</artifactId>
<groupId>com.splunk</groupId>
Expand Down
5 changes: 3 additions & 2 deletions splunk/src/main/java/com/splunk/HttpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ public class HttpService {
private static String HTTPS_SCHEME = "https";
private static String HTTP_SCHEME = "http";
private static String HOSTNAME = "localhost";
private static String HOSTIP = "127.0.0.1";

private static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() {
public boolean verify(String s, SSLSession sslSession) {
if (s.equals(HOSTNAME)) {
if (s.equals(HOSTNAME) || s.equals(HOSTIP)) {
return true;
} else {
HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
Expand Down Expand Up @@ -89,7 +90,7 @@ public boolean verify(String s, SSLSession sslSession) {
private String prefix = null;

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

Expand Down
6 changes: 6 additions & 0 deletions splunk/src/main/java/com/splunk/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,9 @@ public void setBearerToken(String value) {


public boolean enableV2SearchApi(){
if(null == this.instanceType){
this.instanceType = this.getInfo().getInstanceType();
}
if(this.instanceType.equalsIgnoreCase("cloud")) {
return versionIsAtLeast("9.0.2209");
}else{
Expand Down Expand Up @@ -1411,6 +1414,9 @@ boolean versionIsEarlierThan(String version) {
* or 1 if this version is greater than the given version.
*/
public int versionCompare(String otherVersion) {
if(null == this.version){
this.version = this.getInfo().getVersion();
}
String[] components1 = this.version.split("\\.");
String[] components2 = otherVersion.split("\\.");
int numComponents = Math.max(components1.length, components2.length);
Expand Down
15 changes: 15 additions & 0 deletions splunk/src/test/java/com/splunk/ServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,19 @@ public void testEnableV2Api(){
}
}

/*
Test when Service instance is created using token, it doesn't result in Null Pointer while accessing instanceType and version
*/
@Test
public void testServiceWithTokenAuth(){
Service newService = new Service(service.getHost());
newService.setToken(service.getToken());
try{
newService.enableV2SearchApi();
newService.versionCompare("9.0.2");
}catch (Exception ex){
Assert.assertNull(ex);
}
}

}