hawkBit repository uses Optional on single entity find/get requests (#435)

* Repo returns optionals.
* Improved exception handling for collection usage in repo queries.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-02-16 10:09:14 +01:00
committed by GitHub
parent d21af83804
commit 804522f966
232 changed files with 2104 additions and 2377 deletions

View File

@@ -32,7 +32,7 @@ public enum SpServerError {
/**
*
*/
SP_REPO_ENTITY_NOT_EXISTS("hawkbit.server.error.repo.entitiyNotFound", "The given entity does not exist in database"),
SP_REPO_ENTITY_NOT_EXISTS("hawkbit.server.error.repo.entitiyNotFound", "The given entity does not exist in the repository"),
/**
*
*/

View File

@@ -49,7 +49,7 @@ public class TenantConfigurationProperties {
* @return the TenantConfigurationKey with the name keyName
*/
public TenantConfigurationKey fromKeyName(final String keyName) {
return configuration.values().stream().filter(conf -> conf.getKeyName().equals(keyName)).findFirst()
return configuration.values().stream().filter(conf -> conf.getKeyName().equals(keyName)).findAny()
.orElseThrow(() -> new InvalidTenantConfigurationKeyException(
"The given configuration key " + keyName + " does not exist."));
}