This addresses CVE-2022-40151 and CVE-2022-41966, see:
https://x-stream.github.io/changes.html#1.4.20
This version also fixes an issue with closing streams so the workaround in GenerateDefaultTranslationsMojoTest is no longer needed.
Signed-off-by: Wouter Born <github@maindrain.net>
The rxtx serial port provider is now able to scan symlink in /dev/serial/by-id and use them as valid identifier.
Benefit : users won't have to fix the path of their USB serial device with udev anymore, they can now use the explicit and stable symlink directly.
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
[serial] Ability to use /dev/serial/ links
Revert previous commit (rewriting to use discovery serial service to provide the symlinks to all serial provider, and not only rxtx).
Workaround for the rxtx provider which can resolve symlink before using the native code (limit path to 80 char).
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Sync runtime dependencies with Karaf 4.4.3, most notably:
* Jetty 9.4.50.v20221201
* Pax Logging 2.2.0
* Pax Web 8.0.15
* Use OSGi R8 as compile dependency
* Rework Servlets to use Http Whiteboard annotations in favor of proprietary `org.openhab.core.io.http.servlet` classes
* Resolve itest runbundles
Also-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Wouter Born <github@maindrain.net>
* Refactor ThingManagerImpl
This
- moves config description URI to type-base class
- decouples the thing manager from bundle loading
- makes sure that all thing/channel-types and config descriptions are available when the thing is initialized
- enables thing type updates
Signed-off-by: Jan N. Klug <github@klug.nrw>
* rework GenericEventTrigger and GenericEventCondition
fixes#3234
to make their interfaces and semantics match, as well as having a
well defined (and useful) way of defining topic filters
Signed-off-by: Cody Cutrer <cody@cutrer.us>
* Raise source level to Java 17 (except for model classes)
* Remove Nashorn script engine
* Upgrade spotless and add jvm options
See https://github.com/diffplug/spotless/issues/834
* Add suppression for findBugs false positive error
* Upgrade xtext to 2.29.0
* Adjust JNA
* Resolve itests
Signed-off-by: Jan N. Klug <github@klug.nrw>
* Fix missing stateDescriptionProvider in Group items
The stateDescriptionProvider was not properly passed to the base item. Because of that units set in the state description were not properly used when setting the group state after calculating aggregation functions.
Signed-off-by: Jan N. Klug <github@klug.nrw>
* Fix missing initial thing status event
A thing always has a status. This status is not properly propagated to the event bus when the thing is added. This e.g. leads to a situation where a thing's first status that is received by am event subscriber is "INITIALIZING" instead of "UNINITIALIZED". The status should always be sent so that the thing lifecycle can properly be tracked by event listeners.
Signed-off-by: Jan N. Klug <github@klug.nrw>
Nullness default is redundant with a default specified for the enclosing type AutomationIntegrationJsonTest.
Signed-off-by: Wouter Born <github@maindrain.net>
It has been reported in the past (and in the forum) that the EphemerisManagerImpl can't handle illegal configurations. Due to dependencies in other bundles this results in the whole automation component to be unavailable.
Signed-off-by: Jan N. Klug <github@klug.nrw>
This fixes the build being broken when building on Windows.
It also contains many fixes for timing issues which seem to impact macOS and Windows more than Linux.
* Fix .gitattributes and add *.xml_gen to fix line ending issues on Windows
* Derive fork count from CPU details in org.openhab.core tests for more stable tests on machines with fewer cores
* Adjust SafeCallerImplTest timings
* Increase ExecUtilTest timeout
* Increase SchedulerImplTest timeouts
* Increase AudioConsoleTest serveStream timeout
* Increase AudioServletTest serveStream timeout
* Increase SchedulerImplTest test timeouts
* Increase ExpireManagerTest timeout used for checking published events
* Increase PeriodicSchedulerImplTest max allowed delta
* Increase SchedulerImplTest timeouts
* Fix BundleInfoReader file stream not closed causing temp dir deletion issues on Windows
* Fix GenerateDefaultTranslationsMojoTest Windows line endings issues
* Fix GenerateDefaultTranslationsMojoTest Windows temp dir deletion problem
* Fix GenericItemProviderTest tearDown sometimes fails because of queued events
* Fix ChannelLinkNotifierOSGiTest wait for channel link events
* Fix ChannelCommandDescriptionProviderOSGiTest fails if provider not immediately registered
* Fix ChannelStateDescriptionProviderOSGiTest fails if provider not immediately registered
* Fix GenericItemChannelLinkProviderTest not waiting for async updated state to become true
* Fix GenericThingProviderTest failing due to events of previous test
* Fix InboxOSGiTest sometimes fails because of queued events
* Fix ScriptEngineOSGiTest failing because items are not yet added to registry
* Fix ThingManagerOSGiTest failing due to async handleRemoval call
Signed-off-by: Wouter Born <github@maindrain.net>
* Remove duplications
* Better null handling
* Use constants
* Use default waitForAssert timeout (10s)
This may help to get the test more stable (#1089).
Signed-off-by: Wouter Born <github@maindrain.net>
The itests are run using an R7 framework so the inclusion no longer seems required.
This also allows for easily customizing Import-Package headers in itest bundles.
Signed-off-by: Wouter Born <github@maindrain.net>
* Adds some --add-opens to maven-surefire-plugin for:
* modbus transport tests (java.net)
* tests using Gson/XStream (java.util)
* Only run ScriptScopeOSGiTest when Nashorn is available as it has been removed since JDK 15
Signed-off-by: Wouter Born <github@maindrain.net>
* Add more null annotations
* Fix mock name
Adds null annotations to most of the tests as well as a few other classes.
Also fixes a few other SAT findings.
Fixes ~300 SAT findings in total.
Signed-off-by: Wouter Born <github@maindrain.net>
It is probably always a good idea to run the OSGi HTTP service on a random available port in itests.
This fixes some stacktraces when running itests and it will also prevent future issues when tests using the HTTP service are written.
These stacktraces often show when running itests in parallel:
```
org.ops4j.pax.web.pax-web-runtime [org.ops4j.pax.web.service.internal.HttpServiceStarted] ERROR : Could not start the servlet context for context path []
java.io.IOException: Failed to bind to /0.0.0.0:8080
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.ops4j.pax.web.service.jetty.internal.JettyServerImpl$1.start(JettyServerImpl.java:350)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:255)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:226)
at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerServlet(HttpServiceStarted.java:210)
at org.ops4j.pax.web.service.internal.HttpServiceProxy.registerServlet(HttpServiceProxy.java:69)
at org.openhab.core.io.http.servlet.BaseOpenHABServlet.activate(BaseOpenHABServlet.java:56)
at org.openhab.core.io.http.servlet.OpenHABServlet.activate(OpenHABServlet.java:40)
...
```
Similar to: openhab/openhab-addons#11523
Signed-off-by: Wouter Born <github@maindrain.net>
Related to #2688
Updated methods startDialog
New method stopDialog
Null annotations added to the class DialogProcessor
Allow translation of sentences "said" by the dialog processor in case of error
2 console commands added to start and stop a dialog
Enhanced integration tests
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Fixes#2510.
This changes the placeholder syntax used by the reference resolver notably
used in rule templates from `${reference}` to `{{reference}}`.
The former syntax is also used by other languages, notably JavaScript's
template strings, and therefore writing rule templates including JavaScript
code with template strings wouldn't behave as expected.
This also fixes a bug identified in #2510 where you couldn't have a
single closing brace before the start of the first placeholder - which
could more easily happen than having two closing braces.
Signed-off-by: Yannick Schaus <github@schaus.net>
It causes unneccessary bundle refreshes whenever add-ons are installed/uninstalled.
As a result the UI does not get properly notified of installation changes.
Fixes#2580
Reverts the Aries JAX-RS Whiteboard upgrade of #2532
Signed-off-by: Wouter Born <github@maindrain.net>
* New translations audio.properties (Hungarian)
* New translations DefaultSystemChannels.properties (German)
* New translations inbox.properties (Hungarian)
* New translations magic.properties (Hebrew)
* New translations magic.properties (Hungarian)
* New translations magic.properties (Italian)
* New translations marketplace.properties (Hungarian)
* New translations sitemap.properties (Hungarian)
* Fixed unit tests
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
New ItemChannelLinkProviders are added asynchronously to the ItemChannelLinkRegistry, which can cause this test to fail:
TEST org.openhab.core.io.rest.core.internal.link.ItemChannelLinkResourceOSGiTest#shouldReturnLinks() <<< ERROR:
Expected: a collection with size <3>
but: collection size was <0>
java.lang.AssertionError:
Expected: a collection with size <3>
but: collection size was <0>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at org.openhab.core.io.rest.core.internal.link.ItemChannelLinkResourceOSGiTest.shouldReturnLinks(ItemChannelLinkResourceOSGiTest.java:109)
Signed-off-by: Wouter Born <github@maindrain.net>
This prevents typos and using the constants makes it easier to find out what other items types are accepted.
It also makes it easier to see that these values are item types and not labels or descriptions.
Signed-off-by: Wouter Born <github@maindrain.net>
Upgrades XStream from 1.4.15 to 1.4.17
Prevents the following vulnerabilities when using XStream instances with an uninitialized security framework:
* CVE-2021-21341
* CVE-2021-21342
* CVE-2021-21343
* CVE-2021-21344
* CVE-2021-21345
* CVE-2021-21346
* CVE-2021-21347
* CVE-2021-21348
* CVE-2021-21349
* CVE-2021-21350
* CVE-2021-21351
* CVE-2021-29505
See: http://x-stream.github.io/changes.html#1.4.17
Related to: #2250, #2251
Signed-off-by: Wouter Born <github@maindrain.net>
Upgrades UoM dependencies to:
* javax.measure 2.1.2
* si-units 2.0.1
* indriya 2.1.2
An openHAB OSGi-ified si-units bundle is used as runtime dependency, because the latest si-units release is still missing proper OSGi manifest headers.
Notable changes:
* Quantity not longer implements an `equals` method, so the unit tests had to be adjusted. This should have any impact outside of the unit tests though since the rest of openHAB should be using QuantityType instead.
* RationalConverter is not package private, so instances of it much be created through the MultiplyConverter static functions.
* Quantities.getQuantity can no longer parse values without units like `100`. A workaround has been implemented.
* The unicode greek `mu` letter is now returned for unit prefixes instead of the unicode `micro` character. These characters are visually identical but the unit tests had to be adjusted. The new library seems to parse both types just fine.
Also-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>
Signed-off-by: Wouter Born <github@maindrain.net>
* Ignore illegal thing status updates from REMOVING
Ignore illegal thing status transitions from REMOVING instead of throwing IllegalArgumentException
Signed-off-by: Björn Lange <blange@itemis.com>
* Added marker interface for TriggerHandler to indicate if they are time based and thus can be used to simulate execution times.
* Added marker interface for ConditionHandler to indicate, if they are time based and thus can be checked during rule execution for a certain time.
* Moved CronAdjuster to common, so it can be used for the rule simulation
* Created RuleExecutionSimulator that allows simulation of rules
* Added method in RuleManger to create simulation
* Added rest endpoint for rule simulation.
* Changed marker interface to return TemporalAdjuster instead of cron expression. This better hides the internals of the TriggerHandler (i.e. the cron expression) and is more clear and flexible for other handlers to implement
Fixes#2044Fixes#2266
Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
* Aligns compile dependencies with OSGi R7
* Aligns runtime dependencies with Karaf 4.3.1
* Fixes issues due to dependency changes:
* AudioServletTest never ending due to Jetty upgrade
* Feature resolution failing due to Karaf activation-api no longer visible
* Uses Pax Logging as runtime dependency instead of Felix Log
This dependency change makes itests and Demo App behave more like the actual distro
To change the log level in itests, change the value of org.ops4j.pax.logging.DefaultServiceLog.level in itest-include.bndrun
* Adds --add-opens and nashorn.args in itest-include.bndrun to prevent some warnings being logged in itests
Related to openhab/openhab-distro#1167
Signed-off-by: Wouter Born <github@maindrain.net>