diff options
-rw-r--r-- | src/org/traccar/notification/EventForwarder.java | 3 | ||||
-rw-r--r-- | src/org/traccar/notification/MultiPartEventForwarder.java | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java index 1354901a7..68c3ea221 100644 --- a/src/org/traccar/notification/EventForwarder.java +++ b/src/org/traccar/notification/EventForwarder.java @@ -20,7 +20,6 @@ import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder; import java.util.Arrays; import java.util.List; -import org.apache.commons.lang3.StringUtils; import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.Device; @@ -55,7 +54,7 @@ public abstract class EventForwarder { requestBuilder.addHeader("Content-Type", getContentType()); - if (StringUtils.isNotEmpty(header)) { + if (header != null && !header.isEmpty()) { FluentCaseInsensitiveStringsMap params = new FluentCaseInsensitiveStringsMap(); params.putAll(splitIntoKeyValues(header, ":")); requestBuilder.setHeaders(params); diff --git a/src/org/traccar/notification/MultiPartEventForwarder.java b/src/org/traccar/notification/MultiPartEventForwarder.java index 6a3baecb3..f4c36d3e4 100644 --- a/src/org/traccar/notification/MultiPartEventForwarder.java +++ b/src/org/traccar/notification/MultiPartEventForwarder.java @@ -1,11 +1,10 @@ package org.traccar.notification; -import static java.nio.charset.StandardCharsets.UTF_8; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.lang3.StringUtils; import org.traccar.Context; import org.traccar.model.Event; import org.traccar.model.Position; @@ -31,16 +30,17 @@ public class MultiPartEventForwarder extends EventForwarder { @Override protected void setContent(Event event, Position position, BoundRequestBuilder requestBuilder) { - if (StringUtils.isNotEmpty(additionalParams)) { + if (additionalParams != null && !additionalParams.isEmpty()) { Map<String, List<String>> paramsToAdd = splitIntoKeyValues(additionalParams, "="); for (Entry<String, List<String>> param : paramsToAdd.entrySet()) { for (String singleParamValue : param.getValue()) { - requestBuilder.addBodyPart(new StringPart(param.getKey(), singleParamValue, null, UTF_8)); + requestBuilder.addBodyPart(new StringPart(param.getKey(), singleParamValue, null, + StandardCharsets.UTF_8)); } } } requestBuilder.addBodyPart(new StringPart(payloadParamName, - prepareJsonPayload(event, position), "application/json", UTF_8)); + prepareJsonPayload(event, position), "application/json", StandardCharsets.UTF_8)); } } |