Skip to content
Open
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
5 changes: 0 additions & 5 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.9.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
19 changes: 5 additions & 14 deletions api/src/main/java/com/messagebird/MessageBirdServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.messagebird.exceptions.UnauthorizedException;
import com.messagebird.objects.ErrorReport;
import com.messagebird.objects.PagedPaging;
import org.apache.maven.artifact.versioning.ComparableVersion;

import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -62,7 +61,7 @@ public class MessageBirdServiceImpl implements MessageBirdService {
private static final String[] PROTOCOL_LISTS = new String[]{"http://", "https://"};
private static final List<String> PROTOCOLS = Arrays.asList(PROTOCOL_LISTS);

private static final ComparableVersion JAVA_VERSION = getJavaVersion();
private static final String JAVA_VERSION = getJavaVersion();

// Indicates whether we've overridden HttpURLConnection's behaviour to
// allow PATCH requests yet. Also see docs on allowPatchRequestsIfNeeded().
Expand All @@ -89,13 +88,9 @@ public MessageBirdServiceImpl(final String accessKey, final String serviceUrl) {

}

private static ComparableVersion getJavaVersion() {
try {
String version = System.getProperty("java.version");
return new ComparableVersion(version);
} catch (IllegalArgumentException e) {
return new ComparableVersion("0.0");
}
private static String getJavaVersion() {
String version = System.getProperty("java.version");
return version != null ? version : "0.0";
}

private String determineUserAgentString() {
Expand Down Expand Up @@ -637,11 +632,7 @@ private void setAdditionalHeaders(HttpURLConnection connection, Map<String, Stri
}

private DateFormat getDateFormat() {
ComparableVersion java6 = new ComparableVersion("1.6");
if (JAVA_VERSION.compareTo(java6) > 0) {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
}
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZ");
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
}

/**
Expand Down
12 changes: 12 additions & 0 deletions api/src/main/java/com/messagebird/common/StringUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.messagebird.common;

public class StringUtils {

private StringUtils() {
// static utility
}

public static boolean isBlank(String text) {
return text == null || text.trim().isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.messagebird.objects.conversations;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
import com.messagebird.common.StringUtils;

public class MessageParam {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.messagebird.objects.integrations;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
import com.messagebird.common.StringUtils;

import java.util.List;

Expand Down