Reconfigure and apply Spotless (#1442)

Adds a configuration for feature.xml files which will be necessary for https://github.com/openhab/static-code-analysis/pull/375

Also applies the results of running Spotless

Signed-off-by: Wouter Born <github@maindrain.net>
pull/1446/head
Wouter Born 2020-04-23 17:17:12 +02:00 committed by GitHub
parent d371a34321
commit ed4b5ff94b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 36 deletions

View File

@ -315,7 +315,7 @@
<artifactId>jose4j</artifactId>
<version>0.7.0</version>
<scope>compile</scope>
</dependency>
</dependency>
</dependencies>

View File

@ -879,14 +879,14 @@
<version>0.5.8</version>
<!-- <scope>compile</scope> -->
</dependency>
<!-- jose4j -->
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.7.0</version>
<scope>compile</scope>
</dependency>
</dependency>
</dependencies>

View File

@ -26,7 +26,7 @@
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
@ -49,6 +49,6 @@
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>
</project>

View File

@ -9,7 +9,7 @@
<artifactId>org.openhab.core.reactor.bundles</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.core.model.persistence</artifactId>
<name>openHAB Core :: Bundles :: Model Persistence</name>

View File

@ -16,9 +16,9 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openhab.core.items.Item;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.PersistenceServiceConfiguration;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.strategy.PersistenceStrategy;
import org.openhab.core.scheduler.SchedulerRunnable;
import org.slf4j.Logger;
@ -66,7 +66,8 @@ public class PersistItemsJob implements SchedulerRunnable {
}
}
private boolean hasStrategy(List<PersistenceStrategy> defaults, PersistenceItemConfiguration config, String strategyName) {
private boolean hasStrategy(List<PersistenceStrategy> defaults, PersistenceItemConfiguration config,
String strategyName) {
// check if the strategy is directly defined on the config
for (PersistenceStrategy strategy : config.getStrategies()) {
if (strategyName.equals(strategy.getName())) {

View File

@ -252,21 +252,20 @@ public abstract class GenericItem implements ActiveItem {
ExecutorService pool = ThreadPoolManager.getPool(ITEM_THREADPOOLNAME);
try {
final boolean stateChanged = newState != null && !newState.equals(oldState);
clonedListeners.forEach(listener ->
pool.execute(() -> {
try {
listener.stateUpdated(GenericItem.this, newState);
if (stateChanged) {
listener.stateChanged(GenericItem.this, oldState, newState);
}
} catch (Exception e) {
logger.warn("failed notifying listener '{}' about state update of item {}: {}", listener,
GenericItem.this.getName(), e.getMessage(), e);
clonedListeners.forEach(listener -> pool.execute(() -> {
try {
listener.stateUpdated(GenericItem.this, newState);
if (stateChanged) {
listener.stateChanged(GenericItem.this, oldState, newState);
}
}));
} catch (Exception e) {
logger.warn("failed notifying listener '{}' about state update of item {}: {}", listener,
GenericItem.this.getName(), e.getMessage(), e);
}
}));
} catch (IllegalArgumentException e) {
logger.warn("failed comparing oldState '{}' to newState '{}' for item {}: {}", oldState,
newState, GenericItem.this.getName(), e.getMessage(), e);
logger.warn("failed comparing oldState '{}' to newState '{}' for item {}: {}", oldState, newState,
GenericItem.this.getName(), e.getMessage(), e);
}
}

View File

@ -129,8 +129,7 @@
<feature dependency="true">openhab.tp-jbbp</feature>
</feature>
<feature name="openhab-core-io-console-karaf" description="Karaf Console support for SmartHome stuff"
version="${project.version}">
<feature name="openhab-core-io-console-karaf" description="Karaf Console support for SmartHome stuff" version="${project.version}">
<feature>openhab-core-base</feature>
<feature>shell</feature>
<bundle>mvn:org.openhab.core.bundles/org.openhab.core.io.console.karaf/${project.version}</bundle>
@ -469,8 +468,7 @@
</config>
</feature>
<feature name="openhab-runtime-certificate" description="SSL Certificate Generator"
version="${project.version}">
<feature name="openhab-runtime-certificate" description="SSL Certificate Generator" version="${project.version}">
<bundle start-level="20">mvn:org.openhab.core.bundles/org.openhab.core.io.jetty.certificate/${project.version}</bundle>
</feature>

View File

@ -43,8 +43,7 @@
<bundle>mvn:org.eclipse.californium/scandium/2.0.0</bundle>
</feature>
<feature name="openhab.tp-commons-net" description="The Apache Commons Net library"
version="${project.version}">
<feature name="openhab.tp-commons-net" description="The Apache Commons Net library" version="${project.version}">
<capability>openhab.tp;feature=commons-net;version=3.3</capability>
<bundle dependency="true">mvn:commons-net/commons-net/3.3</bundle>
</feature>
@ -170,8 +169,7 @@
<bundle>mvn:de.jollyday/jollyday/0.5.8</bundle>
</feature>
<feature name="openhab.tp-jmdns" description="An implementation of multi-cast DNS in Java."
version="${project.version}">
<feature name="openhab.tp-jmdns" description="An implementation of multi-cast DNS in Java." version="${project.version}">
<capability>openhab.tp;feature=jmdns;version=3.5.5</capability>
<bundle>mvn:org.jmdns/jmdns/3.5.5</bundle>
</feature>
@ -217,8 +215,7 @@
<bundle>mvn:com.neuronrobotics/nrjavaserial/3.20.0</bundle>
</feature>
<feature name="openhab.tp-xtext" description="Xtext - Language Engineering Made Easy"
version="${project.version}">
<feature name="openhab.tp-xtext" description="Xtext - Language Engineering Made Easy" version="${project.version}">
<capability>openhab.tp;feature=xtext;version=2.19.0</capability>
<bundle>mvn:org.eclipse.xtext/org.eclipse.xtext/2.19.0</bundle>
@ -270,11 +267,9 @@
<bundle dependency="true">mvn:org.eclipse.xtext/org.eclipse.xtext.xbase.ide/2.19.0</bundle>
</feature>
<!-- <feature name="openhab.tp-swagger-annotations" description="Swagger Annotations" version="${project.version}"> <bundle
dependency="true">mvn:io.swagger/swagger-annotations/1.5.5</bundle> </feature> -->
<!-- <feature name="openhab.tp-swagger-annotations" description="Swagger Annotations" version="${project.version}"> <bundle dependency="true">mvn:io.swagger/swagger-annotations/1.5.5</bundle> </feature> -->
<feature name="openhab.tp-swagger-jax-rs-provider" description="JAX-RS provider for Swagger integration"
version="${project.version}">
<feature name="openhab.tp-swagger-jax-rs-provider" description="JAX-RS provider for Swagger integration" version="${project.version}">
<details>
This feature is currently only for external usage by products and not used by openHAB Core itself.
</details>

16
pom.xml
View File

@ -576,6 +576,7 @@ Import-Package: \\
<include>src/**/*.xml</include>
</includes>
<excludes>
<exclude>**/feature.xml</exclude>
<exclude>**/pom.xml</exclude>
</excludes>
<eclipseWtp>
@ -588,6 +589,21 @@ Import-Package: \\
<trimTrailingWhitespace />
<endWithNewline />
</format>
<format>
<!-- feature.xml -->
<includes>
<include>src/main/feature/feature.xml</include>
</includes>
<eclipseWtp>
<type>XML</type>
<files>
<file>openhab_wst_feature_file.prefs</file>
</files>
<version>4.12.0</version>
</eclipseWtp>
<trimTrailingWhitespace />
<endWithNewline />
</format>
<format>
<!-- pom.xml -->
<includes>

View File

@ -16,7 +16,7 @@
<features name="${rootArtifactId}-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
<feature name="openhab-binding-${bindingId}" description="${bindingIdCamelCase} Binding" version="${project.version}">
<feature name="openhab-binding-${bindingId}" description="${bindingIdCamelCase} Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/${rootArtifactId}/${project.version}</bundle>
</feature>