contains + get will do its job as long as all collection access uses the
same synchronization locks and as long as every put ensures there will
never by a null value be inserted.
If the map implementation checks if a key is available, we can also get
the value already (IMHO there is no need for the overhead to first
lookup if the key is present and after that is checked, we call the get
function). It should be better to get the value and check if it differs
from null.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
* slf4j logging: remove not needed object array creation
* remove explicit `toString()` calls and check if debug is enabled
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
These changes prepare for custom ScriptEngineFactories and does not
include any breaking changes.
* Moved AbstractScriptEngineFactory out of internal so that it can be
used by custom factories
* Modified ScriptEngineModuleTypeProvider to include engines from custom
factories
* Cleaned up some logging
Signed-off-by: Scott Rushworth <openhab@5iver.com>
To prevent weak cipher/protocol warnings it's better to not customize the default excluded ciphers and protocols.
The MD5 ciphers have already been excluded by default since Jetty 9.3.11.v20160721.
Fixes#1064
Signed-off-by: Wouter Born <github@maindrain.net>
* Added unit test to cover #1226
* Call 'removeItem()' with item name instead of ThingUID
* Added nullness annotations
* Use constructor injection
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Make sure Throwables are not be substituted into log messages so they can be formatted according to the logging configuration.
Signed-off-by: Wouter Born <github@maindrain.net>
Using waitForAssert instead of sleeping 10ms makes the tests stable when the system has some load.
Fixes#1139
Signed-off-by: Wouter Born <github@maindrain.net>
Every connection to the LSP server failed because it always threw a org.eclipse.smarthome.model.ide.SitemapIdeSetup NoClassDefFoundError.
Which is caused by the SitemapIdeSetup residing in a package that is split between both the org.openhab.core.model.item.ide and the org.openhab.core.model.sitemap.ide bundles.
The SitemapIdeSetup class is also using classes from the org.eclipse.smarthome.model package which is also a package split between the org.openhab.core.model.items and org.openhab.core.model.sitemap bundles.
After renaming the packages used for the sitemap classes the NoClassDefFoundError is resolved and LSP works properly again.
Many imports were updated for the sitemap model package changes.
Fixes#1030
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes SAT errors/warnings in resources and tests reported by SAT 0.8.0-SNAPSHOT.
Related to openhab/static-code-analysis#363
Signed-off-by: Wouter Born <github@maindrain.net>
* Added "resources" folder as a resource folder to bnd instructions
Co-Authored-By: Wouter Born <github@maindrain.net>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* Added nullness annotations to o.o.c.binding.xml
* Use local variables
* Removed unuused import
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Added contructor injection to thing xml
* Removed Nullable from getChannels and getChannelGroups
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Added nullness annotations to 'RuleTemplateI18nUtil'
* Added nullness annotations to 'ConfigDescriptionGroupI18nUtil'
* Moved 'ConfigDescriptionI18nUtil' into internal package
* Moved 'ConfigDescriptionGroupI18nUtil' into internal package
* Moved 'ThingTypeI18nUtil' into internal package
* Use 'ConfigI18nLocalizationService' instead of 'ConfigDescriptionI18nUtil'
* Use default labels / descriptions if application of localization is not successful
* Resolved itest.bndrun files
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Adds null annotations to all registries, the interfaces they implement and a few other classes.
Also-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Wouter Born <github@maindrain.net>
* Use !isEmpty() instead of "size() > 0" or "size() != 0"
!isEmpty() expresses the intent more clearly and is therefore preferred.
Counting the number of elements can also be an expensive operation e.g. when using linked lists.
Co-Authored-By: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Wouter Born <github@maindrain.net>
isEmpty() expresses the intent more clearly and is therefore preferred.
Counting the number of elements can also be an expensive operation e.g. when using linked lists.
Signed-off-by: Wouter Born <github@maindrain.net>
* Minor code improvements in profile factory
* Added integration test to check if factory creates all available profiles
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Improve ThingTypeXmlProvider exception handling
When a binding such as ZWave has hundereds of ThingTypes it's hard to debug thing type definition issues.
This PR adds a UID (ConfigDescription, ChannelType, ChannelGroupType and ThingType) to the logging so it will be easier to find the root cause of exceptions.
Because the exceptions are caught, an error in one ThingType definition will no longer prevent other perfectly fine ThingTypes to be registered so the impact of definition issues is reduced.
Signed-off-by: Wouter Born <github@maindrain.net>
Activating the PersistentInbox after the mocks are initialized prevents the TimeToLiveCheckingThread calling the storage mock which would cause the exception.
Fixes#1091
Signed-off-by: Wouter Born <github@maindrain.net>
Suppresses the SystemPrintln SAT findings because this class is a Karaf shell command which prints to the console.
Signed-off-by: Wouter Born <github@maindrain.net>
* Changed pid from 'org.eclipse.smarthome.core.i18nprovider' to 'org.eclipse.smarthome.i18n'
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Fixes wrong names identified by the following rules:
* ConstantNameCheck
* LocalFinalVariableNameCheck
* LocalVariableNameCheck
* StaticVariableNameCheck
Most mismatches identified by the MemberNameCheck have also been fixed except for those where the variables are used in events/DTOs etc which would cause issues.
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes the SAT warning: First javadoc author should have "Initial contribution" contribution description.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move IO HTTP unit tests
All IO HTTP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move thing XML unit tests
Moves the thing XML unit tests from the itests project to the bundle project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move compat1x unit tests
All compat1x tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move model LSP unit tests
All model LSP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move semantics unit tests
All semantics tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move transform unit tests
All transform tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move UI icon unit tests
All UI icon tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* [OAuth2] redirectURI should be optional on getAccessTokenResponseByAuthorizationCode
The redirectURI should be optional (Nullable) on getAccessTokenResponseByAuthorizationCode as in the JavaDoc is stated (as is stated in the refered specification).
* [OAuth2] Removed redundant NonNull
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Wait for stop future to complete and fix the NPE that would cause the future not to complete.
When disconnecting the client the callback is null.
Signed-off-by: Wouter Born <github@maindrain.net>
* Fix DateTimeType parsing of strings with 2 nano digits
Some formatters such as the DateTimeFormatter.ISO_LOCAL_DATE_TIME may also output a string containing 2 nano digits which fail to be parsed by DateTimeValue.
* Fix parsing of arbitrary number of nano digits for Java 11
Signed-off-by: Wouter Born <github@maindrain.net>
* Bump SAT version; Fixed high priority findings
* Defined path to feature file to avoid warnings
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Use constructor injection to simplify lifecycle
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* PR extended by ItemStateConverter
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Use constructor injection to simplify lifecycle
* Added nullness annotations to PersistenceManager
* Removed declaration with null
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Move null annotations between modifiers and variable type
* Remove redundant public modifiers from interfaces where applicable
* Remove redundant `@NonNull` annotations
Signed-off-by: Wouter Born <github@maindrain.net>
Change reference cardinality from MULTIPLE to AT_LEAST_ONE so the serial port provider can be used immediately when ThingHandlers are initialized.
Fixes#937
This would always result in the following logging on startup:
[WARN ] [serial.internal.SerialPortManagerImpl] - No SerialPortProvider found for: /dev/ttyUSB0
Bindings without serial port reconnection logic would need to be manually restarted (Z-Wave Binding).
Signed-off-by: Wouter Born <github@maindrain.net>