From 46e6b854c81498bbc94264ec5468991f62483679 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Sun, 19 Apr 2020 15:52:03 +0200 Subject: [PATCH 1/2] Removed dependency on 'org.apache.commons.lang' Signed-off-by: Christoph Weitkamp --- .../core/audio/internal/AudioServlet.java | 15 +++++++-- .../internal/OAuthClientServiceImpl.java | 4 +-- .../internal/MediaActionTypeProvider.java | 7 +++-- .../DefaultScriptScopeProvider.java | 2 -- .../commands/AutomationCommandsPluggable.java | 4 +-- .../main/java/org/openhab/core/OpenHAB.java | 23 ++++++++++---- .../config/core/internal/ConfigMapper.java | 19 ++++++++---- .../dispatch/internal/ConfigDispatcher.java | 19 +++++++++--- .../internal/SampleExtensionService.java | 11 ++++--- .../org/openhab/core/id/InstanceUUID.java | 3 +- .../internal/ConsoleSupportEclipse.java | 3 +- .../openhab/core/io/net/http/HttpUtil.java | 7 ++--- .../ExtensibleTrustManagerImplTest.java | 31 +++++++++++++------ .../extensions/ExtensionResource.java | 3 +- .../core/internal/thing/ThingResource.java | 3 +- .../sitemap/SitemapSubscriptionService.java | 3 +- .../io/rest/sse/internal/util/SseUtil.java | 5 ++- .../io/rest/internal/filter/CorsFilter.java | 8 ++--- .../transport/mqtt/MqttWillAndTestament.java | 6 ++-- .../MqttBrokerConnectionServiceInstance.java | 3 +- .../mqtt/internal/MqttServiceImpl.java | 3 +- .../client/Mqtt3AsyncClientWrapper.java | 3 +- .../client/Mqtt5AsyncClientWrapper.java | 5 ++- .../core/karaf/internal/FeatureInstaller.java | 24 +++++++------- .../karaf/internal/KarafExtensionService.java | 15 +++++++-- .../core/internal/ModelRepositoryImpl.java | 3 +- bundles/org.openhab.core.model.rule/bnd.bnd | 2 -- .../model/script/actions/ScriptExecution.java | 3 +- .../core/model/script/actions/Voice.java | 8 ++--- .../ScriptImplicitlyImportedTypes.java | 2 -- .../org.openhab.core.model.sitemap/bnd.bnd | 3 +- .../sitemap/internal/SitemapProviderImpl.java | 7 ++--- .../openhab/core/thing/ThingStatusInfo.java | 4 +-- .../binding/firmware/FirmwareBuilder.java | 3 +- .../core/thing/internal/ThingImpl.java | 3 +- .../type/AbstractChannelTypeBuilder.java | 3 +- .../type/StateChannelTypeBuilderImpl.java | 3 +- .../thing/type/ChannelGroupTypeBuilder.java | 4 +-- .../openhab/core/thing/type/ChannelType.java | 3 +- .../core/thing/type/ThingTypeBuilder.java | 13 ++++---- .../core/ui/icon/internal/IconServlet.java | 30 ++++++++++++------ .../AbstractResourceIconProviderTest.java | 16 ++++++++-- .../core/ui/internal/chart/ChartServlet.java | 3 +- .../DefaultChartProvider.java | 3 +- .../components/UIComponentProvider.java | 5 ++- .../ui/internal/items/ItemUIRegistryImpl.java | 7 ++--- .../core/internal/i18n/I18nProviderImpl.java | 5 ++- .../java/org/openhab/core/items/ItemUtil.java | 5 ++- .../openhab/core/items/dto/ItemDTOMapper.java | 3 +- .../core/items/events/ItemEventFactory.java | 7 +++-- .../core/service/AbstractWatchService.java | 9 ++---- .../openhab/core/types/util/UnitUtils.java | 7 ++--- .../core/cache/ExpiringCacheMapTest.java | 9 ++++-- .../openhab/core/cache/ExpiringCacheTest.java | 9 ++++-- .../OH-INF/automation/jsr223/scopeWorking.js | 4 --- .../internal/ConfigDispatcherOSGiTest.java | 7 +++-- .../internal/folder/FolderObserverTest.java | 12 +++---- .../service/AbstractWatchServiceTest.java | 3 +- 58 files changed, 242 insertions(+), 195 deletions(-) diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java index 6b755d80d76..fa3d21ad4fb 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioServlet.java @@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.audio.AudioException; @@ -121,13 +120,23 @@ protected void deactivate() { } } + private String substringAfterLast(String str, String separator) { + int index = str.lastIndexOf(separator); + return index == -1 || index == str.length() - separator.length() ? "" + : str.substring(index + separator.length()); + } + + private String substringBefore(String str, String separator) { + int index = str.indexOf(separator); + return index == -1 ? str : str.substring(0, index); + } + @Override protected void doGet(@NonNullByDefault({}) HttpServletRequest req, @NonNullByDefault({}) HttpServletResponse resp) throws ServletException, IOException { removeTimedOutStreams(); - final String streamId = StringUtils.substringBefore(StringUtils.substringAfterLast(req.getRequestURI(), "/"), - "."); + final String streamId = substringBefore(substringAfterLast(req.getRequestURI(), "/"), "."); try (final InputStream stream = prepareInputStream(streamId, resp)) { if (stream == null) { diff --git a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthClientServiceImpl.java b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthClientServiceImpl.java index 26d90034f73..a92b46aad21 100644 --- a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthClientServiceImpl.java +++ b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthClientServiceImpl.java @@ -25,7 +25,6 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.UrlEncoded; import org.openhab.core.auth.client.oauth2.AccessTokenRefreshListener; import org.openhab.core.auth.client.oauth2.AccessTokenResponse; @@ -302,7 +301,8 @@ public AccessTokenResponse refreshToken() throws OAuthException, IOException, OA persistedParams.scope, Boolean.TRUE.equals(persistedParams.supportsBasicAuth)); // The service may not return the refresh token so use the last refresh token otherwise it's not stored. - if (StringUtil.isBlank(accessTokenResponse.getRefreshToken())) { + String refreshToken = accessTokenResponse.getRefreshToken(); + if (refreshToken == null || refreshToken.isBlank()) { accessTokenResponse.setRefreshToken(lastAccessToken.getRefreshToken()); } // store it diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java index ab392e91cd3..d27d5ca230f 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java @@ -21,7 +21,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.audio.AudioManager; @@ -114,8 +113,10 @@ private List getSoundOptions() { if (soundsDir.isDirectory()) { for (String fileName : soundsDir.list()) { if (fileName.contains(".") && !fileName.startsWith(".")) { - String soundName = StringUtils.capitalize(fileName.substring(0, fileName.lastIndexOf("."))); - options.add(new ParameterOption(fileName, soundName)); + String soundName = fileName.substring(0, fileName.lastIndexOf(".")); + String capitalizedSoundName = soundName.substring(0, 1).toUpperCase() + + soundName.substring(1).toLowerCase(); + options.add(new ParameterOption(fileName, capitalizedSoundName)); } } } diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java index 2932b34abd0..3d278f44c42 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java @@ -21,7 +21,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.automation.RuleRegistry; @@ -90,7 +89,6 @@ public DefaultScriptScopeProvider(final @Reference ItemRegistry itemRegistry, elements.put("State", State.class); elements.put("Command", Command.class); - elements.put("StringUtils", StringUtils.class); elements.put("URLEncoder", URLEncoder.class); elements.put("FileUtils", FileUtils.class); elements.put("FilenameUtils", FilenameUtils.class); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java index 0b40f420c4d..9e21752b26e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java @@ -17,8 +17,8 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -179,7 +179,7 @@ protected void unsetRuleManager(RuleManager ruleManager) { @Override public void execute(String[] args, Console console) { if (args.length == 0) { - console.println(StringUtils.join(getUsages(), "\n")); + console.println(getUsages().stream().collect(Collectors.joining("\n"))); return; } diff --git a/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/OpenHAB.java b/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/OpenHAB.java index e0dd3dbdab7..2bdb942923c 100644 --- a/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/OpenHAB.java +++ b/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/OpenHAB.java @@ -16,8 +16,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; +import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; import org.openhab.core.config.core.ConfigConstants; import org.osgi.framework.FrameworkUtil; @@ -34,6 +34,17 @@ public class OpenHAB { /** the configuraton parameter name used for the base package */ public static final String CFG_PACKAGE = "package"; + private static String substringAfterLast(String str, String separator) { + int index = str.lastIndexOf(separator); + return index == -1 || index == str.length() - separator.length() ? "" + : str.substring(index + separator.length()); + } + + private static String substringBeforeLast(String str, String separator) { + int index = str.lastIndexOf(separator); + return index == -1 ? str : str.substring(0, index); + } + /** * Returns the current openHAB version, retrieving the information from the core bundle version. * @@ -42,10 +53,11 @@ public class OpenHAB { public static String getVersion() { String versionString = FrameworkUtil.getBundle(OpenHAB.class).getVersion().toString(); // if the version string contains a "snapshot" qualifier, remove it! - if (StringUtils.countMatches(versionString, ".") == 3) { - String qualifier = StringUtils.substringAfterLast(versionString, "."); - if (StringUtils.isNumeric(qualifier) || "qualifier".equals(qualifier)) { - versionString = StringUtils.substringBeforeLast(versionString, "."); + if (versionString.chars().filter(ch -> ch == '.').count() == 3) { + final Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?"); + String qualifier = substringAfterLast(versionString, "."); + if (pattern.matcher(qualifier).matches() || "qualifier".equals(qualifier)) { + versionString = substringBeforeLast(versionString, "."); } } return versionString; @@ -53,7 +65,6 @@ public static String getVersion() { public static String buildString() { Properties prop = new Properties(); - Path versionFilePath = Paths.get(ConfigConstants.getUserDataFolder(), "etc", "version.properties"); try (FileInputStream fis = new FileInputStream(versionFilePath.toFile())) { prop.load(fis); diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/ConfigMapper.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/ConfigMapper.java index ee168f5744e..c4ab62fc58e 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/ConfigMapper.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/ConfigMapper.java @@ -13,6 +13,7 @@ package org.openhab.core.config.core.internal; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.math.BigDecimal; @@ -23,7 +24,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.lang.reflect.FieldUtils; import org.eclipse.jdt.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,8 +58,9 @@ public class ConfigMapper { public static @Nullable T as(Map properties, Class configurationClass) { T configuration = null; try { - configuration = configurationClass.newInstance(); - } catch (InstantiationException | IllegalAccessException ex) { + configuration = configurationClass.getConstructor().newInstance(); + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { return null; } @@ -98,9 +99,8 @@ public class ConfigMapper { value = objectConvert(value, type); LOGGER.trace("Setting value ({}) {} to field '{}' in configuration class {}", type.getSimpleName(), value, fieldName, configurationClass.getName()); - FieldUtils.writeField(configuration, fieldName, value, true); - - } catch (Exception ex) { + writeField(configuration, fieldName, value, true); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { LOGGER.warn("Could not set field value for field '{}': {}", fieldName, ex.getMessage(), ex); } } @@ -108,6 +108,13 @@ public class ConfigMapper { return configuration; } + private static void writeField(Object target, String fieldName, Object value, boolean forceAccess) + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { + Field field = target.getClass().getDeclaredField(fieldName); + field.setAccessible(forceAccess); + field.set(target, value); + } + /** * Return fields of the given class as well as all super classes. * diff --git a/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java b/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java index 1628b34252f..770cb7c31f2 100644 --- a/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java +++ b/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java @@ -30,7 +30,6 @@ import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.ConfigConstants; @@ -255,6 +254,16 @@ public int compare(File left, File right) { storeCurrentExclusivePIDList(); } + private String substringBefore(String str, String separator) { + int index = str.indexOf(separator); + return index == -1 ? str : str.substring(0, index); + } + + private String substringBeforeLast(String str, String separator) { + int index = str.lastIndexOf(separator); + return index == -1 ? str : str.substring(0, index); + } + /** * The filename of a given configuration file is assumed to be the service PID. If the filename * without extension contains ".", we assume it is the fully qualified name. @@ -263,7 +272,7 @@ public int compare(File left, File right) { * @return The PID */ private String pidFromFilename(File configFile) { - String filenameWithoutExt = StringUtils.substringBeforeLast(configFile.getName(), "."); + String filenameWithoutExt = substringBeforeLast(configFile.getName(), "."); if (filenameWithoutExt.contains(".")) { // it is a fully qualified namespace return filenameWithoutExt; @@ -412,9 +421,9 @@ private ParseLineResult parseLine(final String filePath, final String line) { } String pid = null; // no override of the pid is default - String key = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); + String key = substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); if (key.contains(DEFAULT_PID_DELIMITER)) { - pid = StringUtils.substringBefore(key, DEFAULT_PID_DELIMITER); + pid = substringBefore(key, DEFAULT_PID_DELIMITER); trimmedLine = trimmedLine.substring(pid.length() + 1); pid = pid.trim(); // PID is not fully qualified, so prefix with namespace @@ -423,7 +432,7 @@ private ParseLineResult parseLine(final String filePath, final String line) { } } if (!trimmedLine.isEmpty() && trimmedLine.substring(1).contains(DEFAULT_VALUE_DELIMITER)) { - String property = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); + String property = substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); String value = trimmedLine.substring(property.length() + 1).trim(); if (value.startsWith(DEFAULT_LIST_STARTING_CHARACTER) && value.endsWith(DEFAULT_LIST_ENDING_CHARACTER)) { logger.debug("Found list in value '{}'", value); diff --git a/bundles/org.openhab.core.extension.sample/src/main/java/org/openhab/core/extension/sample/internal/SampleExtensionService.java b/bundles/org.openhab.core.extension.sample/src/main/java/org/openhab/core/extension/sample/internal/SampleExtensionService.java index 9276f5e721b..d5e9f8e969f 100644 --- a/bundles/org.openhab.core.extension.sample/src/main/java/org/openhab/core/extension/sample/internal/SampleExtensionService.java +++ b/bundles/org.openhab.core.extension.sample/src/main/java/org/openhab/core/extension/sample/internal/SampleExtensionService.java @@ -13,6 +13,7 @@ package org.openhab.core.extension.sample.internal; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -20,8 +21,6 @@ import java.util.Map; import java.util.Random; -import org.apache.commons.lang.RandomStringUtils; -import org.apache.commons.lang.StringUtils; import org.openhab.core.events.Event; import org.openhab.core.events.EventPublisher; import org.openhab.core.extension.Extension; @@ -71,9 +70,11 @@ protected void activate() { for (int i = 0; i < 10; i++) { String id = type.getId() + Integer.toString(i); boolean installed = Math.random() > 0.5; - String name = RandomStringUtils.randomAlphabetic(5); - String label = name + " " + StringUtils.capitalize(type.getId()); + byte[] array = new byte[5]; + new Random().nextBytes(array); + String name = new String(array, StandardCharsets.UTF_8); String typeId = type.getId(); + String label = name + " " + typeId.substring(0, 1).toUpperCase() + typeId.substring(1).toLowerCase(); String version = "1.0"; String link = (Math.random() < 0.5) ? null : "http://lmgtfy.com/?q=" + name; String description = createDescription(); @@ -97,7 +98,7 @@ private String createRandomColor() { } private String createDescription() { - int index = StringUtils.indexOf(LOREM_IPSUM, ' ', RANDOM.nextInt(LOREM_IPSUM.length())); + int index = LOREM_IPSUM.indexOf(" ", RANDOM.nextInt(LOREM_IPSUM.length())); if (index < 0) { index = LOREM_IPSUM.length(); } diff --git a/bundles/org.openhab.core.id/src/main/java/org/openhab/core/id/InstanceUUID.java b/bundles/org.openhab.core.id/src/main/java/org/openhab/core/id/InstanceUUID.java index 7b2235cb5a2..f471b278dc6 100644 --- a/bundles/org.openhab.core.id/src/main/java/org/openhab/core/id/InstanceUUID.java +++ b/bundles/org.openhab.core.id/src/main/java/org/openhab/core/id/InstanceUUID.java @@ -20,7 +20,6 @@ import java.util.List; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.openhab.core.config.core.ConfigConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +54,7 @@ public static synchronized String get() { writeFile(file, uuid); } else { uuid = readFirstLine(file); - if (StringUtils.isNotEmpty(uuid)) { + if (uuid != null && !uuid.isEmpty()) { LOGGER.debug("UUID '{}' has been restored from file '{}'", file.getAbsolutePath(), uuid); } else { uuid = java.util.UUID.randomUUID().toString(); diff --git a/bundles/org.openhab.core.io.console.eclipse/src/main/java/org/openhab/core/io/console/eclipse/internal/ConsoleSupportEclipse.java b/bundles/org.openhab.core.io.console.eclipse/src/main/java/org/openhab/core/io/console/eclipse/internal/ConsoleSupportEclipse.java index 87b535d5f04..c8f532f6160 100644 --- a/bundles/org.openhab.core.io.console.eclipse/src/main/java/org/openhab/core/io/console/eclipse/internal/ConsoleSupportEclipse.java +++ b/bundles/org.openhab.core.io.console.eclipse/src/main/java/org/openhab/core/io/console/eclipse/internal/ConsoleSupportEclipse.java @@ -21,7 +21,6 @@ import java.util.SortedMap; import java.util.TreeMap; -import org.apache.commons.lang.StringUtils; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; import org.openhab.core.io.console.Console; @@ -93,7 +92,7 @@ public Object _smarthome(final CommandInterpreter interpreter) { final List argsList = new ArrayList<>(); while (true) { final String narg = interpreter.nextArgument(); - if (!StringUtils.isEmpty(narg)) { + if (narg != null && !narg.isEmpty()) { argsList.add(narg); } else { break; diff --git a/bundles/org.openhab.core.io.net/src/main/java/org/openhab/core/io/net/http/HttpUtil.java b/bundles/org.openhab.core.io.net/src/main/java/org/openhab/core/io/net/http/HttpUtil.java index f4514d473f3..796cc13e254 100644 --- a/bundles/org.openhab.core.io.net/src/main/java/org/openhab/core/io/net/http/HttpUtil.java +++ b/bundles/org.openhab.core.io.net/src/main/java/org/openhab/core/io/net/http/HttpUtil.java @@ -28,7 +28,6 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.apache.commons.lang.StringUtils; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpProxy; import org.eclipse.jetty.client.ProxyConfiguration; @@ -195,7 +194,7 @@ private static ContentResponse executeUrlAndGetReponse(String httpMethod, String HttpProxy proxy = null; // Only configure a proxy if a host is provided - if (StringUtils.isNotBlank(proxyHost) && proxyPort != null && shouldUseProxy(url, nonProxyHosts)) { + if (proxyHost != null && !proxyHost.isBlank() && proxyPort != null && shouldUseProxy(url, nonProxyHosts)) { AuthenticationStore authStore = httpClient.getAuthenticationStore(); ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration(); List proxies = proxyConfig.getProxies(); @@ -274,7 +273,7 @@ private static ProxyParams prepareProxyParams() { if ("true".equalsIgnoreCase(proxySet)) { proxyParams.proxyHost = System.getProperty("http.proxyHost"); String proxyPortString = System.getProperty("http.proxyPort"); - if (StringUtils.isNotBlank(proxyPortString)) { + if (proxyPortString != null && !proxyPortString.isBlank()) { try { proxyParams.proxyPort = Integer.valueOf(proxyPortString); } catch (NumberFormatException e) { @@ -299,7 +298,7 @@ private static ProxyParams prepareProxyParams() { * nonProxyHosts-list and true otherwise */ private static boolean shouldUseProxy(String urlString, String nonProxyHosts) { - if (StringUtils.isNotBlank(nonProxyHosts)) { + if (nonProxyHosts != null && !nonProxyHosts.isBlank()) { String givenHost = urlString; try { diff --git a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java index a3a34322a96..899d26086b5 100644 --- a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java +++ b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java @@ -15,6 +15,7 @@ import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; +import java.lang.reflect.Field; import java.net.Socket; import java.security.cert.CertificateException; import java.security.cert.CertificateParsingException; @@ -29,7 +30,6 @@ import javax.net.ssl.X509ExtendedTrustManager; import javax.security.auth.x500.X500Principal; -import org.apache.commons.lang.reflect.FieldUtils; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -41,6 +41,7 @@ * @author Martin van Wingerden - Initial contribution */ public class ExtensibleTrustManagerImplTest { + private ExtensibleTrustManagerImpl subject; @Mock @@ -123,8 +124,8 @@ public void shouldForwardCallsToMockForMatchingAlternativeNames() throws Certifi @Test public void shouldBeResilientAgainstNullSubjectAlternativeNames() - throws CertificateException, IllegalAccessException { - FieldUtils.writeField(subject, "defaultTrustManager", defaultTrustManager, true); + throws CertificateException, IllegalAccessException, NoSuchFieldException, SecurityException { + writeField(subject, "defaultTrustManager", defaultTrustManager, true); when(topOfChain.getSubjectX500Principal()) .thenReturn(new X500Principal("CN=example.com, OU=Smarthome, O=Eclipse, C=DE")); @@ -137,8 +138,9 @@ public void shouldBeResilientAgainstNullSubjectAlternativeNames() } @Test - public void shouldBeResilientAgainstMissingCommonNames() throws CertificateException, IllegalAccessException { - FieldUtils.writeField(subject, "defaultTrustManager", defaultTrustManager, true); + public void shouldBeResilientAgainstMissingCommonNames() throws CertificateException, IllegalAccessException, + NoSuchFieldException, SecurityException, IllegalArgumentException { + writeField(subject, "defaultTrustManager", defaultTrustManager, true); when(topOfChain.getSubjectX500Principal()).thenReturn(new X500Principal("OU=Smarthome, O=Eclipse, C=DE")); @@ -149,8 +151,9 @@ public void shouldBeResilientAgainstMissingCommonNames() throws CertificateExcep } @Test - public void shouldBeResilientAgainstInvalidCertificates() throws CertificateException, IllegalAccessException { - FieldUtils.writeField(subject, "defaultTrustManager", defaultTrustManager, true); + public void shouldBeResilientAgainstInvalidCertificates() throws CertificateException, IllegalAccessException, + NoSuchFieldException, SecurityException, IllegalArgumentException { + writeField(subject, "defaultTrustManager", defaultTrustManager, true); when(topOfChain.getSubjectX500Principal()) .thenReturn(new X500Principal("CN=example.com, OU=Smarthome, O=Eclipse, C=DE")); @@ -164,8 +167,9 @@ public void shouldBeResilientAgainstInvalidCertificates() throws CertificateExce } @Test - public void shouldNotForwardCallsToMockForDifferentCN() throws CertificateException, IllegalAccessException { - FieldUtils.writeField(subject, "defaultTrustManager", defaultTrustManager, true); + public void shouldNotForwardCallsToMockForDifferentCN() throws CertificateException, IllegalAccessException, + NoSuchFieldException, SecurityException, IllegalArgumentException { + writeField(subject, "defaultTrustManager", defaultTrustManager, true); mockSubjectForCertificate(topOfChain, "CN=example.com, OU=Smarthome, O=Eclipse, C=DE"); mockIssuerForCertificate(topOfChain, "CN=Eclipse, OU=Smarthome, O=Eclipse, C=DE"); mockSubjectForCertificate(bottomOfChain, "CN=Eclipse, OU=Smarthome, O=Eclipse, C=DE"); @@ -175,7 +179,7 @@ public void shouldNotForwardCallsToMockForDifferentCN() throws CertificateExcept subject.checkServerTrusted(chain, "just"); verify(defaultTrustManager).checkServerTrusted(chain, "just", (Socket) null); - verifyZeroInteractions(trustmanager); + verifyNoInteractions(trustmanager); } private Collection> constructAlternativeNames(String... alternatives) { @@ -194,4 +198,11 @@ private void mockSubjectForCertificate(X509Certificate certificate, String princ private void mockIssuerForCertificate(X509Certificate certificate, String principal) { when(certificate.getIssuerX500Principal()).thenReturn(new X500Principal(principal)); } + + private void writeField(Object target, String fieldName, Object value, boolean forceAccess) + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { + Field field = target.getClass().getDeclaredField(fieldName); + field.setAccessible(forceAccess); + field.set(target, value); + } } diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/extensions/ExtensionResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/extensions/ExtensionResource.java index 67434ff2382..e44f37e5c61 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/extensions/ExtensionResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/extensions/ExtensionResource.java @@ -35,7 +35,6 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.apache.commons.lang.StringUtils; import org.openhab.core.auth.Role; import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.events.Event; @@ -255,7 +254,7 @@ private ExtensionService getExtensionService(final String extensionId) { private String getExtensionId(URI extensionURI) { for (ExtensionService extensionService : extensionServices) { String extensionId = extensionService.getExtensionId(extensionURI); - if (StringUtils.isNotBlank(extensionId)) { + if (extensionId != null && !extensionId.isBlank()) { return extensionId; } } diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java index 5edf6077f0d..b4ad66e285b 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java @@ -46,7 +46,6 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.apache.commons.lang.StringUtils; import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; @@ -546,7 +545,7 @@ public Response updateFirmware( return getThingNotFoundResponse(thingUID); } - if (StringUtils.isEmpty(firmwareVersion)) { + if (firmwareVersion == null || firmwareVersion.isEmpty()) { logger.info( "Received HTTP PUT request for firmware update at '{}' for thing '{}' with unknown firmware version '{}'.", uriInfo.getPath(), thingUID, firmwareVersion); diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java index 4ba2312b79c..a92053d2e65 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java @@ -22,7 +22,6 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.lang.StringUtils; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; import org.eclipse.jdt.annotation.Nullable; @@ -318,7 +317,7 @@ public void modelChanged(String modelName, EventType type) { return; // we process only sitemap modifications here } - String changedSitemapName = StringUtils.removeEnd(modelName, SITEMAP_SUFFIX); + String changedSitemapName = modelName.substring(0, modelName.length() - SITEMAP_SUFFIX.length()); for (Entry listenerEntry : pageChangeListeners.entrySet()) { String sitemapWithPage = listenerEntry.getKey(); diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java index c111da2398c..148854c6a35 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java @@ -18,7 +18,6 @@ import javax.ws.rs.core.MediaType; -import org.apache.commons.lang.StringUtils; import org.glassfish.jersey.media.sse.OutboundEvent; import org.openhab.core.events.Event; import org.openhab.core.io.rest.sse.beans.EventBean; @@ -61,7 +60,7 @@ public static OutboundEvent buildEvent(Event event) { * */ public static boolean isValidTopicFilter(String topicFilter) { - return StringUtils.isEmpty(topicFilter) || topicFilter.matches(TOPIC_VALIDATE_PATTERN); + return topicFilter == null || topicFilter.isEmpty() || topicFilter.matches(TOPIC_VALIDATE_PATTERN); } /** @@ -74,7 +73,7 @@ public static boolean isValidTopicFilter(String topicFilter) { public static List convertToRegex(String topicFilter) { List filters = new ArrayList<>(); - if (StringUtils.isEmpty(topicFilter)) { + if (topicFilter == null || topicFilter.isEmpty()) { filters.add(".*"); } else { StringTokenizer tokenizer = new StringTokenizer(topicFilter, ","); diff --git a/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/filter/CorsFilter.java b/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/filter/CorsFilter.java index 2704bfb7480..7a436340070 100644 --- a/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/filter/CorsFilter.java +++ b/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/filter/CorsFilter.java @@ -25,7 +25,6 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.Provider; -import org.apache.commons.lang.StringUtils; import org.openhab.core.io.rest.internal.Constants; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -102,7 +101,7 @@ private void processRequest(ContainerRequestContext requestContext, ContainerRes if (ACCEPTED_HTTP_METHODS_LIST.contains(requestContext.getMethod()) && !HTTP_OPTIONS_METHOD.equals(requestContext.getMethod())) { String origin = getValue(requestContext.getHeaders(), ORIGIN_HEADER); - if (StringUtils.isNotBlank(origin)) { + if (origin != null && !origin.isBlank()) { responseContext.getHeaders().add(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, origin); } } @@ -122,7 +121,8 @@ private boolean processPreflight(ContainerRequestContext requestContext, Contain // Look for the mandatory CORS preflight request headers String origin = getValue(requestContext.getHeaders(), ORIGIN_HEADER); String realRequestMethod = getValue(requestContext.getHeaders(), ACCESS_CONTROL_REQUEST_METHOD); - isCorsPreflight = StringUtils.isNotBlank(origin) && StringUtils.isNotBlank(realRequestMethod); + isCorsPreflight = origin != null && !origin.isBlank() && realRequestMethod != null + && !realRequestMethod.isBlank(); if (isCorsPreflight) { responseContext.getHeaders().add(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, origin); @@ -161,7 +161,7 @@ private String getValue(MultivaluedMap headers, String header) { */ private void appendVaryHeader(ContainerResponseContext responseContext) { String varyHeader = getValue(responseContext.getStringHeaders(), VARY_HEADER); - if (StringUtils.isBlank(varyHeader)) { + if (varyHeader == null || varyHeader.isBlank()) { // If the Vary header is not present, just add it. responseContext.getHeaders().add(VARY_HEADER, ORIGIN_HEADER); } else if (!VARY_HEADER_WILDCARD.equals(varyHeader)) { diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttWillAndTestament.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttWillAndTestament.java index f4406f4cadc..736ff347929 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttWillAndTestament.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttWillAndTestament.java @@ -14,7 +14,6 @@ import java.nio.charset.StandardCharsets; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -62,7 +61,8 @@ public class MqttWillAndTestament { if (string != null) { String[] components = string.split(":"); for (int i = 0; i < Math.min(components.length, 4); i++) { - String value = StringUtils.trimToEmpty(components[i]); + String component = components[i]; + String value = component == null ? "" : component.trim(); switch (i) { case 0: tmpTopic = value; @@ -117,7 +117,7 @@ public class MqttWillAndTestament { * @param retain true if messages shall be retained */ public MqttWillAndTestament(String topic, byte @Nullable [] payload, int qos, boolean retain) { - if (StringUtils.isBlank(topic)) { + if (topic == null || topic.isBlank()) { throw new IllegalArgumentException("Topic must be set"); } this.topic = topic; diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttBrokerConnectionServiceInstance.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttBrokerConnectionServiceInstance.java index 985c7222810..74858b15045 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttBrokerConnectionServiceInstance.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttBrokerConnectionServiceInstance.java @@ -14,7 +14,6 @@ import java.util.Map; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.Configuration; @@ -75,7 +74,7 @@ public void modified(@Nullable Map configMap) { try { // Compute brokerID and make sure it is not empty String brokerID = config.getBrokerID(); - if (StringUtils.isBlank(brokerID)) { + if (brokerID == null || brokerID.isBlank()) { logger.warn("Ignore invalid broker connection configuration: {}", config); return; } diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceImpl.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceImpl.java index 88e6df610db..fb15f5abce6 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceImpl.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceImpl.java @@ -18,7 +18,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; @@ -90,7 +89,7 @@ public boolean addBrokerConnection(String brokerID, MqttBrokerConnection connect return null; } String host = config.host; - if (StringUtils.isNotBlank(host) && host != null) { + if (host != null && !host.isBlank()) { connection = new MqttBrokerConnection(host, config.port, config.secure, config.clientID); brokerConnections.put(brokerID, connection); } else { diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt3AsyncClientWrapper.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt3AsyncClientWrapper.java index bca27083715..608c5f5fd5b 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt3AsyncClientWrapper.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt3AsyncClientWrapper.java @@ -16,7 +16,6 @@ import javax.net.ssl.TrustManagerFactory; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection.ConnectionCallback; @@ -93,7 +92,7 @@ public CompletableFuture connect(@Nullable MqttWillAndTestament lwt, int keep connectMessageBuilder.willPublish(willPublish); } - if (!StringUtils.isBlank(username) && !StringUtils.isBlank(password) && password != null) { + if (username != null && !username.isBlank() && password != null && !password.isBlank()) { connectMessageBuilder.simpleAuth().username(username).password(password.getBytes()).applySimpleAuth(); } diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt5AsyncClientWrapper.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt5AsyncClientWrapper.java index 8d3b277e95a..e4b8a73e423 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt5AsyncClientWrapper.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/Mqtt5AsyncClientWrapper.java @@ -16,7 +16,6 @@ import javax.net.ssl.TrustManagerFactory; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection.ConnectionCallback; @@ -36,7 +35,7 @@ import com.hivemq.client.mqtt.mqtt5.message.unsubscribe.Mqtt5Unsubscribe; /** - * The {@link Mqtt5AsyncClientWrapper} provides the wrapper for Mqttv3 async clients + * The {@link Mqtt5AsyncClientWrapper} provides the wrapper for Mqttv5 async clients * * @author Jan N. Klug - Initial contribution */ @@ -94,7 +93,7 @@ public CompletableFuture connect(@Nullable MqttWillAndTestament lwt, int keep connectMessageBuilder.willPublish(willPublish); } - if (!StringUtils.isBlank(username) && !StringUtils.isBlank(password) && password != null) { + if (username != null && !username.isBlank() && password != null && !password.isBlank()) { connectMessageBuilder.simpleAuth().username(username).password(password.getBytes()).applySimpleAuth(); } diff --git a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java index 47270d433e2..7f840188776 100644 --- a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java +++ b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java @@ -34,7 +34,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeaturesService; import org.openhab.core.OpenHAB; @@ -208,7 +207,7 @@ public boolean addAddon(String type, String id) { List newAddonIds = new ArrayList<>(trimmedAddonIds.size() + 1); newAddonIds.addAll(trimmedAddonIds); newAddonIds.add(id); - props.put(type, StringUtils.join(newAddonIds, ',')); + props.put(type, newAddonIds.stream().collect(Collectors.joining(","))); cfg.update(props); return true; } else { @@ -232,7 +231,7 @@ public boolean removeAddon(String type, String id) { if (trimmedAddonIds.contains(id)) { List newAddonIds = new ArrayList<>(trimmedAddonIds); boolean success = newAddonIds.remove(id); - props.put(type, StringUtils.join(newAddonIds, ',')); + props.put(type, newAddonIds.stream().collect(Collectors.joining(","))); cfg.update(props); return success; } else { @@ -315,7 +314,7 @@ private boolean setOnlineStatus(boolean status) { } } if (changed) { - properties.put(PROPERTY_MVN_REPOS, StringUtils.join(repoCfg.toArray(), ",")); + properties.put(PROPERTY_MVN_REPOS, repoCfg.stream().collect(Collectors.joining(","))); paxCfg.update(properties); } } catch (IOException e) { @@ -337,7 +336,7 @@ private synchronized void installAddons(final FeaturesService service, final Map try { Feature[] features = service.listInstalledFeatures(); for (String addon : entries) { - if (!StringUtils.isEmpty(addon)) { + if (addon != null && !addon.isEmpty()) { String id = PREFIX + type + "-" + addon.trim(); targetAddons.add(id); if (!isInstalled(features, id)) { @@ -348,7 +347,7 @@ private synchronized void installAddons(final FeaturesService service, final Map // we collect all installed addons for (String addon : getAllAddonsOfType(service, type)) { - if (!StringUtils.isEmpty(addon)) { + if (addon != null && !addon.isEmpty()) { String id = PREFIX + type + "-" + addon.trim(); if (isInstalled(features, id)) { currentAddons.add(id); @@ -393,7 +392,9 @@ private Set getAllAddonsOfType(FeaturesService featuresService, String t private synchronized void installFeatures(FeaturesService featuresService, Set addons) { try { - logger.debug("Installing '{}'", StringUtils.join(addons, ", ")); + if (logger.isDebugEnabled()) { + logger.debug("Installing '{}'", addons.stream().collect(Collectors.joining(", "))); + } featuresService.installFeatures(addons, EnumSet.of(FeaturesService.Option.Upgrade, FeaturesService.Option.NoFailOnFeatureNotFound)); try { @@ -409,11 +410,11 @@ private synchronized void installFeatures(FeaturesService featuresService, Set> getExtensionClasses() { result.remove(BigDecimal.class); result.remove(double.class); result.add(NumberExtensions.class); - result.add(StringUtils.class); result.add(URLEncoder.class); result.add(PersistenceExtensions.class); result.add(BusEvent.class); diff --git a/bundles/org.openhab.core.model.sitemap/bnd.bnd b/bundles/org.openhab.core.model.sitemap/bnd.bnd index 6cf8d41d58d..ec248cb1460 100644 --- a/bundles/org.openhab.core.model.sitemap/bnd.bnd +++ b/bundles/org.openhab.core.model.sitemap/bnd.bnd @@ -11,8 +11,7 @@ Export-Package: org.openhab.core.model.sitemap,\ org.openhab.core.model.sitemap.sitemap.impl,\ org.openhab.core.model.sitemap.sitemap.util,\ org.openhab.core.model.sitemap.validation -Import-Package: org.apache.commons.lang,\ - org.apache.log4j,\ +Import-Package: org.apache.log4j,\ org.eclipse.jdt.annotation;resolution:=optional,\ org.openhab.core.items.dto,\ org.openhab.core.model.core,\ diff --git a/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/internal/SitemapProviderImpl.java b/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/internal/SitemapProviderImpl.java index e8ca9ac4c82..6ca96abf53f 100644 --- a/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/internal/SitemapProviderImpl.java +++ b/bundles/org.openhab.core.model.sitemap/src/org/openhab/core/model/sitemap/internal/SitemapProviderImpl.java @@ -18,15 +18,14 @@ import java.util.concurrent.CopyOnWriteArraySet; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; import org.eclipse.emf.ecore.EObject; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.model.core.EventType; import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.core.ModelRepositoryChangeListener; -import org.openhab.core.model.sitemap.sitemap.Sitemap; import org.openhab.core.model.sitemap.SitemapProvider; +import org.openhab.core.model.sitemap.sitemap.Sitemap; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; @@ -96,8 +95,8 @@ protected void deactivate() { @Override public Set getSitemapNames() { - return sitemapModelCache.keySet().stream().map(name -> StringUtils.removeEnd(name, SITEMAP_FILEEXT)) - .collect(Collectors.toSet()); + return sitemapModelCache.keySet().stream() + .map(name -> name.substring(0, name.length() - SITEMAP_FILEEXT.length())).collect(Collectors.toSet()); } @Override diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingStatusInfo.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingStatusInfo.java index 921a08441b7..8754555df98 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingStatusInfo.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingStatusInfo.java @@ -14,7 +14,6 @@ import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -88,8 +87,9 @@ public ThingStatusDetail getStatusDetail() { @Override public String toString() { + String description = getDescription(); return getStatus() + (getStatusDetail() == ThingStatusDetail.NONE ? "" : " (" + getStatusDetail() + ")") - + (StringUtils.isBlank(getDescription()) ? "" : ": " + getDescription()); + + (description == null || description.isBlank() ? "" : ": " + description); } @Override diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareBuilder.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareBuilder.java index 51cf269241b..d8eb2fcb20f 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareBuilder.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareBuilder.java @@ -17,7 +17,6 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.thing.ThingTypeUID; @@ -215,7 +214,7 @@ private void checkNotNullOrEmpty(@Nullable String string, String argumentName) { * set to true, but the model ({@link #withModel(String)}) is not set */ public Firmware build() { - if (modelRestricted && StringUtils.isEmpty(model)) { + if (modelRestricted && (model == null || model.isEmpty())) { throw new IllegalArgumentException("Cannot create model restricted firmware without model"); } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingImpl.java index a5f7ff729fa..303a41fafd8 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingImpl.java @@ -18,7 +18,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.Configuration; @@ -226,7 +225,7 @@ public Map getProperties() { @Override public @Nullable String setProperty(String name, @Nullable String value) { - if (StringUtils.isEmpty(name)) { + if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Property name must not be null or empty"); } synchronized (this) { diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/AbstractChannelTypeBuilder.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/AbstractChannelTypeBuilder.java index 524fe1833bf..df931d743b4 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/AbstractChannelTypeBuilder.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/AbstractChannelTypeBuilder.java @@ -17,7 +17,6 @@ import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.thing.type.ChannelType; @@ -46,7 +45,7 @@ public AbstractChannelTypeBuilder(ChannelTypeUID channelTypeUID, String label) { throw new IllegalArgumentException("ChannelTypeUID must be set."); } - if (StringUtils.isEmpty(label)) { + if (label == null || label.isEmpty()) { throw new IllegalArgumentException("Label for a ChannelType must not be empty."); } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/StateChannelTypeBuilderImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/StateChannelTypeBuilderImpl.java index 3f059ffdc5e..55677a927f2 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/StateChannelTypeBuilderImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/type/StateChannelTypeBuilderImpl.java @@ -12,7 +12,6 @@ */ package org.openhab.core.thing.internal.type; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.thing.type.AutoUpdatePolicy; @@ -42,7 +41,7 @@ public class StateChannelTypeBuilderImpl extends AbstractChannelTypeBuilder 0 && width > maxWidth) { diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java index 736c4e72360..ae14af331c8 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; import org.knowm.xchart.Chart; import org.knowm.xchart.ChartBuilder; import org.knowm.xchart.Series; @@ -400,7 +399,7 @@ private ChartTheme getChartTheme(String name) { } String chartThemeName = name; // no theme name -> default theme - if (StringUtils.isBlank(name)) { + if (name == null || name.isBlank()) { chartThemeName = CHART_THEME_DEFAULT_NAME; } ChartTheme chartTheme = chartThemes.get(chartThemeName); diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/components/UIComponentProvider.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/components/UIComponentProvider.java index 2c68a183881..22949ad641e 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/components/UIComponentProvider.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/components/UIComponentProvider.java @@ -16,7 +16,6 @@ import java.util.Collection; import java.util.List; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.common.registry.AbstractProvider; @@ -62,7 +61,7 @@ public Collection getAll() { @Override public void add(RootUIComponent element) { - if (StringUtils.isEmpty(element.getUID())) { + if (element.getUID().isEmpty()) { throw new IllegalArgumentException("Invalid UID"); } @@ -103,7 +102,7 @@ public void add(RootUIComponent element) { @Override public @Nullable RootUIComponent get(String key) { - if (StringUtils.isEmpty(key)) { + if (key.isEmpty()) { throw new IllegalArgumentException("Invalid UID"); } return storage.get(key); diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java index be7e6c7e153..ccdaa93d2e6 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java @@ -28,7 +28,6 @@ import javax.measure.Unit; -import org.apache.commons.lang.StringUtils; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; @@ -314,7 +313,7 @@ private Switch createPlayerButtons() { String label = getLabelFromWidget(w); String itemName = w.getItem(); - if (StringUtils.isBlank(itemName)) { + if (itemName == null || itemName.isBlank()) { return transform(label, true, null); } @@ -1350,7 +1349,7 @@ public void removeRegistryHook(RegistryHook hook) { // we require the item to define a dimension, otherwise no unit will be reported to the UIs. if (item instanceof NumberItem && ((NumberItem) item).getDimension() != null) { String unit = getUnitFromLabel(w.getLabel()); - if (StringUtils.isNotBlank(unit) && !UnitUtils.UNIT_PLACEHOLDER.equals(unit)) { + if (!UnitUtils.UNIT_PLACEHOLDER.equals(unit)) { return unit; } @@ -1374,7 +1373,7 @@ public void removeRegistryHook(RegistryHook hook) { } private @Nullable String getUnitFromLabel(String label) { - if (StringUtils.isBlank(label)) { + if (label.isBlank()) { return null; } diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/i18n/I18nProviderImpl.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/i18n/I18nProviderImpl.java index f7d6bb1df39..ee80539e7cf 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/i18n/I18nProviderImpl.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/i18n/I18nProviderImpl.java @@ -34,7 +34,6 @@ import javax.measure.quantity.Temperature; import javax.measure.spi.SystemOfUnits; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.i18n.LocaleProvider; @@ -178,7 +177,7 @@ private void setMeasurementSystem(@Nullable String measurementSystem) { private void setLocale(@Nullable String language, @Nullable String script, @Nullable String region, @Nullable String variant) { Locale oldLocale = this.locale; - if (StringUtils.isEmpty(language)) { + if (language == null || language.isEmpty()) { // at least the language must be defined otherwise the system default locale is used logger.debug("No language set, setting locale to 'null'."); locale = null; @@ -251,7 +250,7 @@ private void setLocation(final @Nullable String location) { private void setTimeZone(final @Nullable String zoneId) { ZoneId oldTimeZone = this.timeZone; - if (StringUtils.isBlank(zoneId)) { + if (zoneId == null || zoneId.isBlank()) { timeZone = null; } else { try { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemUtil.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemUtil.java index a094466d229..86012bd1061 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemUtil.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemUtil.java @@ -14,7 +14,6 @@ import java.util.Objects; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.internal.service.BundleResolverImpl; @@ -58,8 +57,8 @@ private ItemUtil() { * @param itemName the name of the item to be checked (could be null or empty) * @return true if the specified name is a valid item name, otherwise false */ - public static boolean isValidItemName(final String itemName) { - return StringUtils.isNotEmpty(itemName) && itemName.matches("[a-zA-Z0-9_]*"); + public static boolean isValidItemName(final @Nullable String itemName) { + return itemName != null && !itemName.isEmpty() && itemName.matches("[a-zA-Z0-9_]*"); } /** diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTOMapper.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTOMapper.java index 135b2c5cd17..3d6d2bf9493 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTOMapper.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTOMapper.java @@ -17,7 +17,6 @@ import javax.measure.Quantity; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.internal.items.GroupFunctionHelper; @@ -64,7 +63,7 @@ public class ItemDTOMapper { if (itemDTO instanceof GroupItemDTO && GroupItem.TYPE.equals(itemDTO.type)) { GroupItemDTO groupItemDTO = (GroupItemDTO) itemDTO; Item baseItem = null; - if (!StringUtils.isEmpty(groupItemDTO.groupType)) { + if (groupItemDTO.groupType != null && !groupItemDTO.groupType.isEmpty()) { baseItem = itemBuilderFactory.newItemBuilder(groupItemDTO.groupType, itemDTO.name).build(); builder.withBaseItem(baseItem); } diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemEventFactory.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemEventFactory.java index 995c4744db9..6bc1d288c80 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemEventFactory.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemEventFactory.java @@ -19,7 +19,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.commons.lang.StringUtils; import org.openhab.core.events.AbstractEventFactory; import org.openhab.core.events.Event; import org.openhab.core.events.EventFactory; @@ -388,11 +387,13 @@ private static ItemDTO map(Item item) { } private static String getStateType(State state) { - return StringUtils.removeEnd(state.getClass().getSimpleName(), TYPE_POSTFIX); + String stateClassName = state.getClass().getSimpleName(); + return stateClassName.substring(0, stateClassName.length() - TYPE_POSTFIX.length()); } private static String getCommandType(Command command) { - return StringUtils.removeEnd(command.getClass().getSimpleName(), TYPE_POSTFIX); + String commandClassName = command.getClass().getSimpleName(); + return commandClassName.substring(0, commandClassName.length() - TYPE_POSTFIX.length()); } private static void assertValidArguments(String itemName, Type type, String typeArgumentName) { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/service/AbstractWatchService.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/service/AbstractWatchService.java index c012d9facd0..75f506b3a32 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/service/AbstractWatchService.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/service/AbstractWatchService.java @@ -19,7 +19,7 @@ import java.nio.file.WatchKey; import java.nio.file.WatchService; -import org.apache.commons.lang.StringUtils; +import org.eclipse.jdt.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,11 +77,8 @@ public void deactivate() { * @return the path to be watched as a {@link String}. The returned path should be applicable for creating a * {@link Path} with the {@link Paths#get(String, String...)} method. */ - public Path getSourcePath() { - if (StringUtils.isNotBlank(pathToWatch)) { - return Paths.get(pathToWatch); - } - return null; + public @Nullable Path getSourcePath() { + return pathToWatch == null || pathToWatch.isBlank() ? null : Paths.get(pathToWatch); } /** diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/util/UnitUtils.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/util/UnitUtils.java index 1e445558624..8a7e54df16b 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/util/UnitUtils.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/util/UnitUtils.java @@ -27,7 +27,6 @@ import javax.measure.UnitConverter; import javax.measure.spi.SystemOfUnits; -import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.internal.library.unit.UnitInitializer; @@ -76,7 +75,7 @@ public class UnitUtils { * @throws IllegalArgumentException in case no class instance could be parsed from the given dimension. */ public static @Nullable Class> parseDimension(String dimension) { - if (StringUtils.isBlank(dimension)) { + if (dimension.isBlank()) { return null; } @@ -144,7 +143,7 @@ public class UnitUtils { * */ public static @Nullable Unit parseUnit(@Nullable String pattern) { - if (StringUtils.isBlank(pattern)) { + if (pattern == null || pattern.isBlank()) { return null; } @@ -154,7 +153,7 @@ public class UnitUtils { unitSymbol = pattern.substring(lastBlankIndex).trim(); } - if (StringUtils.isNotBlank(unitSymbol) && !UNIT_PLACEHOLDER.equals(unitSymbol)) { + if (!UNIT_PLACEHOLDER.equals(unitSymbol)) { if (UNIT_PERCENT_FORMAT_STRING.equals(unitSymbol)) { return SmartHomeUnits.PERCENT; } diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheMapTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheMapTest.java index ed6aa5d122a..a0ea65742d6 100755 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheMapTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheMapTest.java @@ -14,14 +14,15 @@ import static org.junit.Assert.*; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.LinkedHashSet; import java.util.LinkedList; +import java.util.Random; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import org.apache.commons.lang.RandomStringUtils; import org.junit.Before; import org.junit.Test; @@ -37,7 +38,11 @@ public class ExpiringCacheMapTest { private static final String RESPONSE_1 = "ACTION 1"; private static final String RESPONSE_2 = "ACTION 2"; - private static final Supplier CACHE_ACTION = () -> RandomStringUtils.random(8); + private static final Supplier CACHE_ACTION = () -> { + byte[] array = new byte[8]; + new Random().nextBytes(array); + return new String(array, StandardCharsets.UTF_8); + }; private static final Supplier PREDICTABLE_CACHE_ACTION_1 = () -> RESPONSE_1; private static final Supplier PREDICTABLE_CACHE_ACTION_2 = () -> RESPONSE_2; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheTest.java index e80639632ed..94677ed5660 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/cache/ExpiringCacheTest.java @@ -14,10 +14,11 @@ import static org.junit.Assert.*; +import java.nio.charset.StandardCharsets; +import java.util.Random; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import org.apache.commons.lang.RandomStringUtils; import org.junit.Before; import org.junit.Test; @@ -28,7 +29,11 @@ */ public class ExpiringCacheTest { private static final long CACHE_EXPIRY = TimeUnit.SECONDS.toMillis(2); - private static final Supplier CACHE_ACTION = () -> RandomStringUtils.random(8); + private static final Supplier CACHE_ACTION = () -> { + byte[] array = new byte[8]; + new Random().nextBytes(array); + return new String(array, StandardCharsets.UTF_8); + }; private ExpiringCache subject; diff --git a/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/resources/OH-INF/automation/jsr223/scopeWorking.js b/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/resources/OH-INF/automation/jsr223/scopeWorking.js index da5057928fb..e997ffab980 100644 --- a/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/resources/OH-INF/automation/jsr223/scopeWorking.js +++ b/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/resources/OH-INF/automation/jsr223/scopeWorking.js @@ -8,10 +8,6 @@ if(Command === undefined) { throw "Command not defined"; } -if(StringUtils === undefined) { - throw "StringUtils not defined"; -} - if(URLEncoder === undefined) { throw "URLEncoder not defined"; } diff --git a/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java b/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java index 91bc9b6a9ff..95f21e7b402 100644 --- a/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java +++ b/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java @@ -26,7 +26,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -1035,6 +1034,7 @@ private void truncateLastLine(File file) throws IOException { private String getLastModifiedValueForPoperty(String path, String property) { // This method will return null, if there are no files in the directory. + final String separator = property + "="; String value = null; File file = getLastModifiedFileFromDir(path); @@ -1044,8 +1044,9 @@ private String getLastModifiedValueForPoperty(String path, String property) { try (FileInputStream fileInputStream = new FileInputStream(file)) { List lines = IOUtils.readLines(fileInputStream); for (String line : lines) { - if (line.contains(property + "=")) { - value = StringUtils.substringAfter(line, property + "="); + int index = line.indexOf(separator); + if (index != -1) { + value = line.substring(index + separator.length()); } } } catch (IOException e) { diff --git a/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java b/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java index 1486acc8daf..2a6176a6af6 100644 --- a/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java +++ b/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java @@ -30,7 +30,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.SystemUtils; import org.eclipse.emf.ecore.EObject; import org.junit.After; import org.junit.Before; @@ -68,6 +67,7 @@ */ public class FolderObserverTest extends JavaOSGiTest { + private static final boolean IS_OS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); private static final File WATCHED_DIRECTORY = new File("watcheddir"); private static final File UNWATCHED_DIRECTORY = new File("unwatcheddir"); private static final String EXISTING_SUBDIR_NAME = "existingsubdir"; @@ -164,7 +164,7 @@ public void testCreation() throws Exception { * In some OS, like MacOS, creating an empty file is not related to sending an ENTRY_CREATE event. * So, it's necessary to put some initial content in that file. */ - if (!SystemUtils.IS_OS_WINDOWS) { + if (!IS_OS_WINDOWS) { FileUtils.writeStringToFile(file, INITIAL_FILE_CONTENT); } @@ -205,7 +205,7 @@ public void testModification() throws Exception { * In some OS, like MacOS, creating an empty file is not related to sending an ENTRY_CREATE event. So, it's * necessary to put some initial content in that file. */ - if (!SystemUtils.IS_OS_WINDOWS) { + if (!IS_OS_WINDOWS) { FileUtils.writeStringToFile(file, INITIAL_FILE_CONTENT, true); } @@ -223,7 +223,7 @@ public void testModification() throws Exception { waitForAssert(() -> assertThat(modelRepo.calledFileName, is(file.getName()))); String finalFileContent; - if (!SystemUtils.IS_OS_WINDOWS) { + if (!IS_OS_WINDOWS) { finalFileContent = INITIAL_FILE_CONTENT + text; } else { finalFileContent = text; @@ -350,7 +350,7 @@ public boolean addOrRefreshModel(String name, InputStream inputStream) { File mockFileWithValidExt = new File(EXISTING_SUBDIR_PATH, "MockFileForModification." + validExtension); mockFileWithValidExt.createNewFile(); - if (!SystemUtils.IS_OS_WINDOWS) { + if (!IS_OS_WINDOWS) { FileUtils.writeStringToFile(mockFileWithValidExt, INITIAL_FILE_CONTENT); } @@ -380,7 +380,7 @@ public void testHiddenFile() throws Exception { String filename = ".HiddenNewlyCreatedMockFile." + validExtension; - if (!SystemUtils.IS_OS_WINDOWS) { + if (!IS_OS_WINDOWS) { /* * In some OS, like MacOS, creating an empty file is not related to sending an ENTRY_CREATE event. * So, it's necessary to put some initial content in that file. diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java index 604da8e30a1..08d1bbb4cd3 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java @@ -27,7 +27,6 @@ import java.util.stream.Stream; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.SystemUtils; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -54,7 +53,7 @@ public class AbstractWatchServiceTest extends JavaTest { @BeforeClass public static void setUpBeforeClass() { // set the NO_EVENT_TIMEOUT_IN_SECONDS according to the operating system used - if (SystemUtils.IS_OS_MAC_OSX) { + if (System.getProperty("os.name").startsWith("Mac OS X")) { noEventTimeoutInSeconds = 15; } else { noEventTimeoutInSeconds = 3; From e78b3da7d0e538df208e2ffec52a352115844619 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Wed, 22 Apr 2020 11:05:08 +0200 Subject: [PATCH 2/2] Resolved itest.bndrun Signed-off-by: Christoph Weitkamp --- itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun | 1 - .../itest.bndrun | 1 - .../itest.bndrun | 1 - .../itest.bndrun | 1 - .../itest.bndrun | 1 - .../itest.bndrun | 1 - itests/org.openhab.core.automation.tests/itest.bndrun | 1 - itests/org.openhab.core.binding.xml.tests/itest.bndrun | 1 - itests/org.openhab.core.config.core.tests/itest.bndrun | 1 - .../org.openhab.core.config.discovery.mdns.tests/itest.bndrun | 1 - itests/org.openhab.core.config.discovery.tests/itest.bndrun | 1 - .../itest.bndrun | 1 - .../itest.bndrun | 1 - itests/org.openhab.core.config.dispatch.tests/itest.bndrun | 1 - itests/org.openhab.core.config.xml.tests/itest.bndrun | 1 - itests/org.openhab.core.ephemeris.tests/itest.bndrun | 1 - itests/org.openhab.core.io.rest.core.tests/itest.bndrun | 1 - itests/org.openhab.core.model.core.tests/itest.bndrun | 3 +-- itests/org.openhab.core.model.item.tests/itest.bndrun | 3 +-- itests/org.openhab.core.model.persistence.tests/itest.bndrun | 3 +-- itests/org.openhab.core.model.rule.tests/itest.bndrun | 4 +--- itests/org.openhab.core.model.script.tests/itest.bndrun | 3 +-- itests/org.openhab.core.model.thing.tests/itest.bndrun | 4 ++-- itests/org.openhab.core.storage.json.tests/itest.bndrun | 1 - itests/org.openhab.core.tests/itest.bndrun | 1 - itests/org.openhab.core.thing.tests/itest.bndrun | 1 - itests/org.openhab.core.thing.xml.tests/itest.bndrun | 1 - itests/org.openhab.core.voice.tests/itest.bndrun | 1 - 28 files changed, 7 insertions(+), 35 deletions(-) diff --git a/itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun b/itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun index c2aa501d856..05befa5cdb4 100644 --- a/itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun +++ b/itests/org.openhab.core.auth.oauth2client.tests/itest.bndrun @@ -10,7 +10,6 @@ Fragment-Host: org.openhab.core.auth.oauth2client # -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.automation.integration.tests/itest.bndrun b/itests/org.openhab.core.automation.integration.tests/itest.bndrun index c2df5095ac9..972e9cd88c1 100644 --- a/itests/org.openhab.core.automation.integration.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.integration.tests/itest.bndrun @@ -13,7 +13,6 @@ Bundle-SymbolicName: ${project.artifactId} com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.automation.module.core.tests/itest.bndrun b/itests/org.openhab.core.automation.module.core.tests/itest.bndrun index 00845afcc3e..d0ffd57cf25 100644 --- a/itests/org.openhab.core.automation.module.core.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.module.core.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.automation com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.automation.module.script.defaultscope.tests/itest.bndrun b/itests/org.openhab.core.automation.module.script.defaultscope.tests/itest.bndrun index f9d88664795..73cd30a7ca9 100644 --- a/itests/org.openhab.core.automation.module.script.defaultscope.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.module.script.defaultscope.tests/itest.bndrun @@ -13,7 +13,6 @@ Bundle-SymbolicName: ${project.artifactId} com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.automation.module.script.tests/itest.bndrun b/itests/org.openhab.core.automation.module.script.tests/itest.bndrun index 1f1fec54396..4e7f3677b0b 100644 --- a/itests/org.openhab.core.automation.module.script.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.module.script.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.automation.module.script com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.automation.module.timer.tests/itest.bndrun b/itests/org.openhab.core.automation.module.timer.tests/itest.bndrun index a8c79b28b78..cf5693391e9 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.module.timer.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.automation -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.automation.tests/itest.bndrun b/itests/org.openhab.core.automation.tests/itest.bndrun index e1198da1fb3..5f2d3d32db7 100644 --- a/itests/org.openhab.core.automation.tests/itest.bndrun +++ b/itests/org.openhab.core.automation.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.automation com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.binding.xml.tests/itest.bndrun b/itests/org.openhab.core.binding.xml.tests/itest.bndrun index 389d5c2fe7a..09ddefaaa18 100644 --- a/itests/org.openhab.core.binding.xml.tests/itest.bndrun +++ b/itests/org.openhab.core.binding.xml.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.binding.xml -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.config.core.tests/itest.bndrun b/itests/org.openhab.core.config.core.tests/itest.bndrun index d52956da3ab..1c7327e4377 100644 --- a/itests/org.openhab.core.config.core.tests/itest.bndrun +++ b/itests/org.openhab.core.config.core.tests/itest.bndrun @@ -12,7 +12,6 @@ Fragment-Host: org.openhab.core.config.core -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.config.discovery.mdns.tests/itest.bndrun b/itests/org.openhab.core.config.discovery.mdns.tests/itest.bndrun index 7fb9fb6a881..f08d72f7b65 100644 --- a/itests/org.openhab.core.config.discovery.mdns.tests/itest.bndrun +++ b/itests/org.openhab.core.config.discovery.mdns.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.config.discovery.mdns -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.config.discovery.tests/itest.bndrun b/itests/org.openhab.core.config.discovery.tests/itest.bndrun index a5c0b1f925a..67e7804caaf 100644 --- a/itests/org.openhab.core.config.discovery.tests/itest.bndrun +++ b/itests/org.openhab.core.config.discovery.tests/itest.bndrun @@ -13,7 +13,6 @@ Fragment-Host: org.openhab.core.config.discovery -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/itest.bndrun b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/itest.bndrun index 4e4dc7bc50b..2f90c686bc5 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/itest.bndrun +++ b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.config.discovery.usbserial.linuxsysfs com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.specs.activation-api-1.1;version='[2.9.0,2.9.1)',\ diff --git a/itests/org.openhab.core.config.discovery.usbserial.tests/itest.bndrun b/itests/org.openhab.core.config.discovery.usbserial.tests/itest.bndrun index b60b5584777..478816232a4 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.tests/itest.bndrun +++ b/itests/org.openhab.core.config.discovery.usbserial.tests/itest.bndrun @@ -24,7 +24,6 @@ Provide-Capability: \ com.google.gson;version='[2.8.2,2.8.3)',\ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.config.dispatch.tests/itest.bndrun b/itests/org.openhab.core.config.dispatch.tests/itest.bndrun index e47baf7ca0c..5f96759b323 100644 --- a/itests/org.openhab.core.config.dispatch.tests/itest.bndrun +++ b/itests/org.openhab.core.config.dispatch.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.config.dispatch -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.config.xml.tests/itest.bndrun b/itests/org.openhab.core.config.xml.tests/itest.bndrun index b7ef83027f9..7bccfb2d920 100644 --- a/itests/org.openhab.core.config.xml.tests/itest.bndrun +++ b/itests/org.openhab.core.config.xml.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.config.xml -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.ephemeris.tests/itest.bndrun b/itests/org.openhab.core.ephemeris.tests/itest.bndrun index 144e92049c1..a35a70e77ec 100644 --- a/itests/org.openhab.core.ephemeris.tests/itest.bndrun +++ b/itests/org.openhab.core.ephemeris.tests/itest.bndrun @@ -22,7 +22,6 @@ feature.openhab-config: \ -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.io.rest.core.tests/itest.bndrun b/itests/org.openhab.core.io.rest.core.tests/itest.bndrun index 7a868bf6284..130f865f674 100644 --- a/itests/org.openhab.core.io.rest.core.tests/itest.bndrun +++ b/itests/org.openhab.core.io.rest.core.tests/itest.bndrun @@ -17,7 +17,6 @@ Fragment-Host: org.openhab.core.io.rest.core net.minidev.accessors-smart;version='[1.2.0,1.2.1)',\ net.minidev.json-smart;version='[2.3.0,2.3.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.model.core.tests/itest.bndrun b/itests/org.openhab.core.model.core.tests/itest.bndrun index 981ce6e0815..61af211f762 100644 --- a/itests/org.openhab.core.model.core.tests/itest.bndrun +++ b/itests/org.openhab.core.model.core.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.model.core log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.emf.common;version='[2.12.0,2.12.1)',\ @@ -97,4 +96,4 @@ Fragment-Host: org.openhab.core.model.core org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ org.openhab.core.voice;version='[3.0.0,3.0.1)',\ - org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' + org.openhab.core.model.rule.runtime;version='[3.0.0,3.0.1)' diff --git a/itests/org.openhab.core.model.item.tests/itest.bndrun b/itests/org.openhab.core.model.item.tests/itest.bndrun index c62f7edc76a..3017900f002 100644 --- a/itests/org.openhab.core.model.item.tests/itest.bndrun +++ b/itests/org.openhab.core.model.item.tests/itest.bndrun @@ -16,7 +16,6 @@ Fragment-Host: org.openhab.core.model.item log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.emf.common;version='[2.12.0,2.12.1)',\ org.eclipse.emf.ecore;version='[2.12.0,2.12.1)',\ @@ -96,4 +95,4 @@ Fragment-Host: org.openhab.core.model.item org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ org.openhab.core.voice;version='[3.0.0,3.0.1)',\ - org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' + org.openhab.core.model.rule.runtime;version='[3.0.0,3.0.1)' diff --git a/itests/org.openhab.core.model.persistence.tests/itest.bndrun b/itests/org.openhab.core.model.persistence.tests/itest.bndrun index c0a503f1ded..47197d1d153 100644 --- a/itests/org.openhab.core.model.persistence.tests/itest.bndrun +++ b/itests/org.openhab.core.model.persistence.tests/itest.bndrun @@ -16,7 +16,6 @@ Fragment-Host: org.openhab.core.model.persistence log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.emf.common;version='[2.12.0,2.12.1)',\ org.eclipse.emf.ecore;version='[2.12.0,2.12.1)',\ @@ -112,4 +111,4 @@ Fragment-Host: org.openhab.core.model.persistence org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ org.openhab.core.voice;version='[3.0.0,3.0.1)',\ - org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' + org.openhab.core.model.rule.runtime;version='[3.0.0,3.0.1)' diff --git a/itests/org.openhab.core.model.rule.tests/itest.bndrun b/itests/org.openhab.core.model.rule.tests/itest.bndrun index daec215f64e..537fb388409 100644 --- a/itests/org.openhab.core.model.rule.tests/itest.bndrun +++ b/itests/org.openhab.core.model.rule.tests/itest.bndrun @@ -16,7 +16,6 @@ Fragment-Host: org.openhab.core.model.rule.runtime log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.emf.common;version='[2.12.0,2.12.1)',\ @@ -95,5 +94,4 @@ Fragment-Host: org.openhab.core.model.rule.runtime org.openhab.core.test;version='[3.0.0,3.0.1)',\ org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ - org.openhab.core.voice;version='[3.0.0,3.0.1)',\ - org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' + org.openhab.core.voice;version='[3.0.0,3.0.1)' diff --git a/itests/org.openhab.core.model.script.tests/itest.bndrun b/itests/org.openhab.core.model.script.tests/itest.bndrun index 27b11edab35..5b517023dc1 100644 --- a/itests/org.openhab.core.model.script.tests/itest.bndrun +++ b/itests/org.openhab.core.model.script.tests/itest.bndrun @@ -16,7 +16,6 @@ Fragment-Host: org.openhab.core.model.script log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.emf.common;version='[2.12.0,2.12.1)',\ @@ -95,5 +94,5 @@ Fragment-Host: org.openhab.core.model.script org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ org.openhab.core.voice;version='[3.0.0,3.0.1)',\ - org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' + org.openhab.core.model.rule.runtime;version='[3.0.0,3.0.1)' \ No newline at end of file diff --git a/itests/org.openhab.core.model.thing.tests/itest.bndrun b/itests/org.openhab.core.model.thing.tests/itest.bndrun index ad5935a5417..c16f12479f3 100644 --- a/itests/org.openhab.core.model.thing.tests/itest.bndrun +++ b/itests/org.openhab.core.model.thing.tests/itest.bndrun @@ -18,7 +18,6 @@ Fragment-Host: org.openhab.core.model.thing log4j;version='[1.2.17,1.2.18)',\ org.antlr.runtime;version='[3.2.0,3.2.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ @@ -106,5 +105,6 @@ Fragment-Host: org.openhab.core.model.thing org.openhab.core.thing;version='[3.0.0,3.0.1)',\ org.openhab.core.thing.xml;version='[3.0.0,3.0.1)',\ org.openhab.core.transform;version='[3.0.0,3.0.1)',\ - org.openhab.core.voice;version='[3.0.0,3.0.1)' + org.openhab.core.voice;version='[3.0.0,3.0.1)',\ + org.openhab.core.model.sitemap.runtime;version='[3.0.0,3.0.1)' diff --git a/itests/org.openhab.core.storage.json.tests/itest.bndrun b/itests/org.openhab.core.storage.json.tests/itest.bndrun index 25a22cda5fb..dc8fcfa98b2 100644 --- a/itests/org.openhab.core.storage.json.tests/itest.bndrun +++ b/itests/org.openhab.core.storage.json.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.storage.json -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.tests/itest.bndrun b/itests/org.openhab.core.tests/itest.bndrun index 790bd24ba09..a2103c9b38d 100644 --- a/itests/org.openhab.core.tests/itest.bndrun +++ b/itests/org.openhab.core.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\ diff --git a/itests/org.openhab.core.thing.tests/itest.bndrun b/itests/org.openhab.core.thing.tests/itest.bndrun index cc462400879..b15b3699896 100644 --- a/itests/org.openhab.core.thing.tests/itest.bndrun +++ b/itests/org.openhab.core.thing.tests/itest.bndrun @@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.thing -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ diff --git a/itests/org.openhab.core.thing.xml.tests/itest.bndrun b/itests/org.openhab.core.thing.xml.tests/itest.bndrun index b66ca6397db..d689a33d367 100644 --- a/itests/org.openhab.core.thing.xml.tests/itest.bndrun +++ b/itests/org.openhab.core.thing.xml.tests/itest.bndrun @@ -13,7 +13,6 @@ Fragment-Host: org.openhab.core.thing.xml -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\ org.apache.servicemix.bundles.xstream;version='[1.4.7,1.4.8)',\ diff --git a/itests/org.openhab.core.voice.tests/itest.bndrun b/itests/org.openhab.core.voice.tests/itest.bndrun index 9f50ac9c0ff..2512c91929f 100644 --- a/itests/org.openhab.core.voice.tests/itest.bndrun +++ b/itests/org.openhab.core.voice.tests/itest.bndrun @@ -11,7 +11,6 @@ Fragment-Host: org.openhab.core.voice -runbundles: \ javax.measure.unit-api;version='[1.0.0,1.0.1)',\ org.apache.commons.io;version='[2.2.0,2.2.1)',\ - org.apache.commons.lang;version='[2.6.0,2.6.1)',\ org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\ org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\ org.apache.felix.scr;version='[2.1.10,2.1.11)',\