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.4

### Minor Changes
* Added check for localhost IPv6 address, for IPv6 compatible apps (GitHub PR [#210](https://github.com/splunk/splunk-sdk-java/pull/210))
* Updating SSL_SOCKET_FACTORY instance on changing _validateCertificates_ flag. (GitHub PR [#206](https://github.com/splunk/splunk-sdk-java/pull/210))

## Version 1.9.3

### Minor Changes
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.3
#### Version 1.9.4

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.3</version>
<version>1.9.4</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.3"
declare -r version="1.9.4"

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.3.jar**, **target/splunk-1.9.3-javadoc.jar**, and
**target/splunk-1.9.3-sources.jar** to the **local**, **staging**, or **production**
Deploy transmits **target/splunk-1.9.4.jar**, **target/splunk-1.9.4-javadoc.jar**, and
**target/splunk-1.9.4-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.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
com/splunk/splunk/1.9.4/
├── splunk-1.9.4-javadoc.jar
├── splunk-1.9.4-javadoc.jar.md5
├── splunk-1.9.4-javadoc.jar.sha1
├── splunk-1.9.4-sources.jar
├── splunk-1.9.4-sources.jar.md5
├── splunk-1.9.4-sources.jar.sha1
├── splunk-1.9.4.jar
├── splunk-1.9.4.jar.md5
├── splunk-1.9.4.jar.sha1
├── splunk-1.9.4.pom
├── splunk-1.9.4.pom.md5
└── splunk-1.9.4.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.3</version>
<version>1.9.4</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.3</version.number>
<version.number>1.9.4</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.3</version>
<version>1.9.4</version>
<parent>
<artifactId>splunk-sdk-java</artifactId>
<groupId>com.splunk</groupId>
Expand Down
13 changes: 9 additions & 4 deletions splunk/src/main/java/com/splunk/HttpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ public class HttpService {
private static String HTTP_SCHEME = "http";
private static String HOSTNAME = "localhost";
private static String HOSTIP = "127.0.0.1";
private static String HOSTIPv6 = "::1";

private static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() {
public boolean verify(String s, SSLSession sslSession) {
if (s.equals(HOSTNAME) || s.equals(HOSTIP)) {
if (s.equals(HOSTNAME) || s.equals(HOSTIP) || s.equals(HOSTIPv6)) {
return true;
} else {
HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
Expand Down Expand Up @@ -90,7 +91,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.3");
put("User-Agent", "splunk-sdk-java/1.9.4");
put("Accept", "*/*");
}};

Expand Down Expand Up @@ -558,8 +559,12 @@ public static SSLSocketFactory getSSLSocketFactory() {
return HttpService.sslSocketFactory;
}

public static void setValidateCertificates(boolean validateCertificates) {
HttpService.validateCertificates = validateCertificates;
public static void setValidateCertificates(boolean validateCertificate) {
// update the SSL_SOCKET_FACTORY if validateCertificates flag is changed
if (validateCertificates != validateCertificate) {
validateCertificates = validateCertificate;
sslSocketFactory = createSSLFactory();
}
}

public static SSLSocketFactory createSSLFactory() {
Expand Down
23 changes: 23 additions & 0 deletions splunk/src/test/java/com/splunk/HttpServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ public void setUp() throws Exception {
);
}

@Test
public void testHttpServiceWithHostIP(){
HttpService service = new HttpService("127.0.0.1");
ResponseMessage response = service.get("/");
Assert.assertEquals(200, response.getStatus());
Assert.assertTrue(firstLineIsXmlDtd(response.getContent()));
}

@Test
public void testHttpServiceWithHostIPv6(){
// IPv6 Host without the [] brackets
HttpService service = new HttpService("::1");
ResponseMessage response = service.get("/");
Assert.assertEquals(200, response.getStatus());
Assert.assertTrue(firstLineIsXmlDtd(response.getContent()));

// IPv6 Host with the [] brackets
HttpService newService = new HttpService("[::1]");
ResponseMessage resp = newService.get("/");
Assert.assertEquals(200, resp.getStatus());
Assert.assertTrue(firstLineIsXmlDtd(resp.getContent()));
}

@Test
public void testGet() {
ResponseMessage response = httpService.get("/");
Expand Down