Commit Graph

471 Commits

Author SHA1 Message Date
Wouter Born
26a958cd4d
Use static inner classes (#4002)
A static inner class does not keep an implicit reference to its enclosing instance.
This prevents a common cause of memory leaks and uses less memory per instance of the class.

Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-03 12:35:26 +01:00
Wouter Born
10c0cf8211
Simplify assertions (#3996)
* Simplify assertions

Using the appropriate assertion methods results in less and easier to read code as well as better error messages when assertions fail.

Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-03 12:24:50 +01:00
Wouter Born
58a106d36d
Use diamond operator (#4001)
Often the type can be inferred so the diamond operator can be used to simplify the code.

Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-03 08:22:43 +01:00
Wouter Born
dc5f50db63
Fix assertEquals order (#3995)
The first parameter should be the expected value and the second parameter the actual value.

Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-02 22:27:53 +01:00
Wouter Born
89b67adbd7
Use isEmpty instead of 0 comparisons (#3999)
`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>
2024-01-02 18:47:36 +01:00
J-N-K
a5316f920e
Refactor ThingHandlerService to an OSGi component prototype (#3957)
Also-by: Connor Petty <mistercpp2000+gitsignoff@gmail.com>
Signed-off-by: J-N-K <github@klug.nrw>
2024-01-02 13:09:51 +01:00
Wouter Born
ba5647b871
More code cleanups (#3975)
While cleaning up the code I found a some more code to cleanup:

* Remove unnecessary boxing
* Use `contains(..)` instead of `indexOf(..) != -1`
* Use `assertInstanceOf` in tests
* Make expensive trace logging conditional
* Remove redundant constructor
* Replace `collect(Collectors.toUnmodifiableList())` with `toList()`
* Replace `filter(..).count() == 0L` with `noneMatch(..)`
* Replace `filter(..).count() > 0` with `anyMatch(..)`

Signed-off-by: Wouter Born <github@maindrain.net>
2023-12-28 13:15:50 +01:00
Wouter Born
0e03943e48
Use String.join instead of Collectors.joining (#3973)
* Use String.join instead of Collectors.joining

String.join results in less code when joining an Iterable or Array.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-12-28 13:11:14 +01:00
Holger Friedrich
bada23fdb8
Minor code cleanup (#3942)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
2023-12-23 12:54:29 +01:00
Holger Friedrich
839ba1ab4c
Apply spotless after release, resolve bundles (#3953)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
2023-12-22 23:14:28 +01:00
openhab-bot
3b279587b1 [unleash-maven-plugin] Preparation for next development cycle. 2023-12-22 11:48:43 +00:00
Wouter Born
81f14c9df1
Upgrade logback-classic to 1.3.14 (#3935) 2023-12-19 23:26:22 +01:00
Mark Herwege
fe242f8ab9
Modified finder discovery schema to make future finders easier to create (#3924)
* change discovery method schema

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
2023-12-16 11:08:09 +01:00
Andrew Fiddian-Green
cc9b70516a
AddonInfo extensions (#3865)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
2023-12-05 16:49:31 +01:00
J-N-K
cdbca4dd0a
Allow sending TimeSeries for items (#3597)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-11-07 20:08:41 -08:00
Wouter Born
783c57cbb9
Use 'uid' instead of 'UID' as method parameters (#3840)
Using 'UID' is confusing as method parameter because it can be mistaken for some kind of constant while reading code.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-09 21:39:47 +02:00
Wouter Born
e8e1c9fe73
Simplify code that creates List, Map and Set objects (#3836)
Simplifies the code by using List.of, List.copyOf etc. where possible which results in less code and imports.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-09 18:00:00 +02:00
Wouter Born
09b3160a55
Simplify code using Stream.toList (#3831)
Stream.toList was introduced in Java 16 and creates an unmodifiable List so it can be used to simplify code whenever the List is not expected to be modified.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-09 09:20:08 +02:00
Wouter Born
eff85c6470
Upgrade JUnit to 5.10.0 (#3832)
Upgrades JUnit from 5.9.2 to 5.10.0.

For release notes, see:

https://junit.org/junit5/docs/5.10.0/release-notes/#release-notes-5.10.0

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-07 20:34:47 +02:00
Wouter Born
fb3d4e805d
Update bnd to 7.0.0 (#3828)
For release notes, see:

https://github.com/bndtools/bnd/wiki/Changes-in-7.0.0

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-06 18:45:20 +02:00
Wouter Born
02f6c5c3e3
Upgrade CXF to 3.6.2 (#3826)
Upgrades CXF from 3.6.1 to 3.6.2.

For release notes, see:

https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310511&version=12353311

It has a fix to address OOM issues when using HTTP clients:

https://issues.apache.org/jira/browse/CXF-8885

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-04 11:46:54 +02:00
Wouter Born
fffa968263
Upgrade Xtext/Xtend to 2.32.0, LSP4J to 0.21.0 (#3817)
Upgrades Xtext and its dependencies to:

* Xtext/Xtend 2.32.0
* LSP4J 0.21.0
* GSON 2.10.1
* Guava 32.1.2
* Guice 7.0.0

For release notes, see:

https://eclipse.dev/Xtext/releasenotes.html#/releasenotes/2023/08/27/version-2-32-0

Fixes #3321

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-01 22:04:27 +02:00
Wouter Born
d4a433a4ce
Upgrade to Karaf 4.4.4 (#3814)
* Sync runtime dependencies with Karaf 4.4.4, most notably:
  * Jetty 9.4.52.v20230823
  * JNA 5.13.0
  * SLF4J 2.0.6
  * Pax Logging 2.2.3
  * Pax Web 8.0.22
* Resolve itest runbundles
* Use new Pax Web features to simplify dependency management
* Add specs features because Pax Web now depends on "asm"

Signed-off-by: Wouter Born <github@maindrain.net>
2023-09-29 20:23:31 +02:00
J-N-K
af4fce1e4f
Fix CommunicationManager command handling (#3714)
* Fix CommunicationManager

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-09-13 22:27:12 +02:00
Wouter Born
e1d2b88398
Update directory-watcher to 0.18.0 (#3790)
Updates the directory-watcher from 0.17.1 to 0.18.0.

This version has some bug fixes/improvements, see:

https://github.com/gmethvin/directory-watcher/compare/v0.17.1...v0.18.0

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-30 22:51:25 +02:00
Wouter Born
c39d15ade6
Cleanup code (#3787)
This code cleanup fixes various warnings in Eclipse.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-30 22:50:17 +02:00
Wouter Born
e765af06cb
Upgrade Maven and plug-ins (#3788)
* Use Maven 3.9.4 with GitHub Actions CI
* Upgrade Maven plug-ins

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-30 13:29:34 +02:00
Wouter Born
5daf4ff076
Fix SAT and null analysis issues (#3781)
Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-27 11:15:15 +02:00
Wouter Born
9e1dbb6435
Update json-path to 2.8.0 (#3772)
Updates json-path from 2.4.0 to 2.8.0

This addresses:

* CVE-2021-27568
* CVE-2021-31684
* CVE-2023-1370

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-26 15:08:46 +02:00
Wouter Born
7743e9f9ab
Update CXF to 3.6.1 (#3770)
Updates CXF from 3.4.5 to 3.6.1

For some recent release notes, see:

* [3.5.0](https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310511&version=12348382)
* [3.6.0](https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310511&version=12351469)
* [3.6.1](https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310511&version=12353191)

This upgrade addresses:

* CVE-2022-46363
* CVE-2022-46364

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-21 21:23:09 +02:00
Wouter Born
c0b4ccfd7c
Update Jackson to 2.15.2 (#3768)
Updates Jackson from 2.14.1 to 2.15.2

For release notes, see:

https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.15

This upgrade addresses:

* CVE-2022-1471

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-21 10:22:27 +02:00
J-N-K
a2401059e5
Improve AutomationIntegrationJsonTest (#3760)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-08-19 10:16:22 +02:00
J-N-K
04eb32185c
Bump UoM libraries to 2.2 (#3758)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-08-18 21:38:43 +02:00
Wouter Born
aef57edd73
Use workaround to fix high CPU usage by LinkedTransferQueue (#3756)
This is a workaround for JDK-8301341 by using the Java 11 LinkedTransferQueue with the QueueingThreadPoolExecutor in the Core and jUPnP.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-14 10:37:20 +02:00
Wouter Born
17e9cf3850
ZipException workarounds (#3747)
* Use Karaf 4.4.3 compile dependency
* Disable this feature in itests

Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-11 14:10:00 +02:00
Wouter Born
3b91692be1
Fix build (#3726)
Signed-off-by: Wouter Born <github@maindrain.net>
2023-07-24 09:02:01 +02:00
Kai Kreuzer
5692232e2b Apply spotless
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2023-07-24 01:11:37 +02:00
openhab-bot
fd93f0a766 [unleash-maven-plugin] Preparation for next development cycle. 2023-07-23 17:14:35 +00:00
J-N-K
546e34252f
Fix system started DSL rules (#3725)
* Fix system started DSL rules

Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2023-07-23 10:21:37 +02:00
J-N-K
b8ae55c3f5
Fix rule startlevel trigger executes during initialization (#3717)
* Fix rule startlevel trigger executes during initialization

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-07-21 14:18:28 +02:00
J-N-K
5a00bfdc41
Align system-channel-types for electricity (#3707)
* Align system-channel-types for electricity

These are only used by one binding at the moment and it's very inconsistent to have power, voltage and current with the "electric" prefix and energy with "electrical".

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-07-18 09:05:42 +02:00
Wouter Born
3396ff7758
Use Eclipse formatter 4.25 with Spotless (#3710)
Fixes #3515

Signed-off-by: Wouter Born <github@maindrain.net>
2023-07-18 09:03:16 +02:00
J-N-K
78e66745ab
Add support for things with generic channels (#3355)
* Add support for generic channels

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-06-25 16:22:55 +02:00
J-N-K
64fd046266
Bump spifly to 1.3.6 and asm to 9.4 to support records (#3658)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-06-23 10:46:43 +02:00
Yannick Schaus
6e83d3f8de
"Cacheability" option for critical REST resources (#3335)
* Closes #3329.

This implements a new optional `cacheable` parameter for these REST endpoints:
- `/rest/items`
- `/rest/things`
- `/rest/rules`

When this parameter is set, a flat list of all elements excluding
non-cacheable fields (e.g. "state", "transformedState", "stateDescription",
"commandDescription" for items, "statusInfo", "firmwareStatus",
"properties" for things, "status" for rules) will be retrieved along with
a `Last-Modified` HTTP response header. When unknown, the Last-Modified
header will be set to the date of the request.

Also only when this parameter is set, and a `If-Modified-Since` header is
found in the request, that header will be compared to the last known
modified date for the corresponding cacheable list. The last modified date
will be reset when any change is made on the elements of the underlying
registry. If the `If-Modified-Since` date is equal or more recent than the
last modified date, then a 304 Not Modified response with no content will
be served instead of the usual 200 OK, informing the client that its
cache is still valid at the provided date.

All other request parameters will be ignored except for "metadata" in the
`/rest/items` endpoint. When a metadata selector is set, the resulting
item list will be considered like a completely different resource, i.e.
it will have its own last modified date. Regarding metadata, the approach
to invalidating last modified dates is very conservative: when any metadata
is changed, all cacheable lists of items will have their last modified date
reset even if the change was in a metadata namespace that wasn't requested.

This also implements the abovedescribed behavior for the
`/rest/ui/components/{namespace}` endpoint, but no `cacheable` parameter
is necessary. The last modified date is tracked by namespace.

Signed-off-by: Yannick Schaus <github@schaus.net>
2023-06-15 20:16:14 +02:00
J-N-K
d34b9164f7
Trigger immediately when start level already reached (#3278)
* Trigger immediately when start level already reached

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-05-28 10:14:03 +02:00
J-N-K
9ef076dc6a
[uom] Add unit metadata for NumberItem (#3481)
* Add defaultUnit metadata for NumberItem

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-05-09 22:42:25 +02:00
J-N-K
8e1a2cfd0a
Add an AbstractStorageBasedTypeProvider (#3407)
* Add an AbstractDynamicTypeProvider

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-05-07 21:51:10 +02:00
J-N-K
960cf0c179
Improve thing updates (#3576)
* Improve thing updates

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-05-07 20:46:42 +02:00
Jacob Laursen
c8464870bb
[ephemeris] Add support for overriding holiday definitions (#3573)
* Add support for overriding holiday definitions

End Danish General Prayer Day

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
2023-05-02 09:11:59 +02:00