From 09e466a4a2d72c1c2db7cd7807253a8a37435fd5 Mon Sep 17 00:00:00 2001
From: Pieter12345
Date: Thu, 21 Mar 2019 21:15:38 +0100
Subject: [PATCH] Replace StringUtils.join() with library call
Use Apache commons.lang3 instead of own implementation.
---
app/test/processing/app/helpers/StringUtilsTest.java | 1 +
.../arduino/packages/discoverers/PluggableDiscovery.java | 3 ++-
.../src/cc/arduino/packages/uploaders/SSHUploader.java | 3 ++-
arduino-core/src/processing/app/helpers/StringUtils.java | 8 --------
4 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/app/test/processing/app/helpers/StringUtilsTest.java b/app/test/processing/app/helpers/StringUtilsTest.java
index 1ddbf51b3..9cc595542 100644
--- a/app/test/processing/app/helpers/StringUtilsTest.java
+++ b/app/test/processing/app/helpers/StringUtilsTest.java
@@ -29,6 +29,7 @@
package processing.app.helpers;
+import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
diff --git a/arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java b/arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java
index d37166699..3f7202fa6 100644
--- a/arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java
+++ b/arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java
@@ -36,6 +36,8 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.JsonFactory;
@@ -48,7 +50,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import cc.arduino.packages.BoardPort;
import cc.arduino.packages.Discovery;
import processing.app.PreferencesData;
-import processing.app.helpers.StringUtils;
public class PluggableDiscovery implements Discovery {
diff --git a/arduino-core/src/cc/arduino/packages/uploaders/SSHUploader.java b/arduino-core/src/cc/arduino/packages/uploaders/SSHUploader.java
index 5b4896313..fb0eb3ffb 100644
--- a/arduino-core/src/cc/arduino/packages/uploaders/SSHUploader.java
+++ b/arduino-core/src/cc/arduino/packages/uploaders/SSHUploader.java
@@ -44,7 +44,6 @@ import processing.app.debug.TargetPlatform;
import processing.app.helpers.PreferencesMap;
import processing.app.helpers.PreferencesMapException;
import processing.app.helpers.StringReplacer;
-import processing.app.helpers.StringUtils;
import java.io.File;
import java.io.IOException;
@@ -54,6 +53,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+
import static processing.app.I18n.tr;
public class SSHUploader extends Uploader {
diff --git a/arduino-core/src/processing/app/helpers/StringUtils.java b/arduino-core/src/processing/app/helpers/StringUtils.java
index f20461c63..0e5b883ed 100644
--- a/arduino-core/src/processing/app/helpers/StringUtils.java
+++ b/arduino-core/src/processing/app/helpers/StringUtils.java
@@ -15,12 +15,4 @@ public class StringUtils {
}
return s.substring(0, i + 1);
}
-
- public static String join(String[] arr, String separator) {
- StringBuffer sb = new StringBuffer();
- for (String s : arr) {
- sb.append(s).append(separator);
- }
- return sb.substring(0, sb.length() - separator.length());
- }
}