Warning hunt in org.openhab.core.addon.xxx (#4489)

Signed-off-by: Gaël L'hopital <gael@lhopital.org>
This commit is contained in:
Gaël L'hopital 2024-12-16 19:04:55 +01:00 committed by GitHub
parent c2d8392668
commit 576a63c0be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 26 additions and 44 deletions

View File

@ -140,15 +140,17 @@ public class BundleVersion {
}
// the release is always newer than a milestone or snapshot
if (qualifier == null) { // we are the release
Long thisQualifier = qualifier;
if (thisQualifier == null) { // we are the release
return 1;
}
if (other.qualifier == null) { // the other is the release
Long otherQualifier = other.qualifier;
if (otherQualifier == null) { // the other is the release
return -1;
}
// both versions are milestones, we can compare them
return Long.compare(qualifier, other.qualifier);
return Long.compare(thisQualifier, otherQualifier);
}
@Override

View File

@ -13,8 +13,7 @@
package org.openhab.core.addon.marketplace.internal.community;
import static org.openhab.core.addon.marketplace.MarketplaceConstants.*;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.JSON_CONTENT_PROPERTY;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.YAML_CONTENT_PROPERTY;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.*;
import java.io.IOException;
import java.io.InputStream;
@ -26,8 +25,6 @@ import org.openhab.core.addon.Addon;
import org.openhab.core.addon.marketplace.MarketplaceAddonHandler;
import org.openhab.core.addon.marketplace.MarketplaceHandlerException;
import org.openhab.core.addon.marketplace.internal.automation.MarketplaceRuleTemplateProvider;
import org.openhab.core.automation.template.RuleTemplateProvider;
import org.openhab.core.storage.Storage;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@ -36,8 +33,9 @@ import org.slf4j.LoggerFactory;
/**
* A {@link MarketplaceAddonHandler} implementation, which handles rule templates as JSON files and installs
* them by adding them to a {@link Storage}. The templates are then served from this storage through a dedicated
* {@link RuleTemplateProvider}.
* them by adding them to a {@link org.openhab.core.storage.Storage}. The templates are then served from this storage
* through a dedicated
* {@link org.openhab.core.automation.template.RuleTemplateProvider}.
*
* @author Kai Kreuzer - Initial contribution and API
* @author Yannick Schaus - refactoring

View File

@ -13,8 +13,7 @@
package org.openhab.core.addon.marketplace.internal.community;
import static org.openhab.core.addon.marketplace.MarketplaceConstants.*;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.JSON_CONTENT_PROPERTY;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.YAML_CONTENT_PROPERTY;
import static org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.*;
import java.io.IOException;
import java.io.InputStream;
@ -151,7 +150,8 @@ public class CommunityTransformationAddonHandler implements MarketplaceAddonHand
private PersistedTransformation addTransformationFromJSON(String id, String json) {
try {
PersistedTransformation transformation = gson.fromJson(json, PersistedTransformation.class);
PersistedTransformation transformation = Objects
.requireNonNull(gson.fromJson(json, PersistedTransformation.class));
storage.put(id, transformation);
return transformation;
} catch (JsonParseException e) {

View File

@ -28,8 +28,6 @@ import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link AddonInfoRegistry} provides access to {@link AddonInfo} objects.
@ -42,8 +40,6 @@ import org.slf4j.LoggerFactory;
@NonNullByDefault
public class AddonInfoRegistry {
private final Logger logger = LoggerFactory.getLogger(AddonInfoRegistry.class);
private final Collection<AddonInfoProvider> addonInfoProviders = new CopyOnWriteArrayList<>();
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)

View File

@ -22,12 +22,12 @@ import org.openhab.core.addon.AddonParameter;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link AddonDiscoveryMethodConverter} is a concrete implementation of the {@code XStream} {@link Converter}
* The {@link AddonDiscoveryMethodConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter}
* interface used to convert add-on discovery method information within an XML document into a
* {@link AddonDiscoveryMethod} object.
*

View File

@ -26,12 +26,12 @@ import org.openhab.core.config.core.xml.util.ConverterAttributeMapValidator;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link AddonInfoConverter} is a concrete implementation of the {@code XStream} {@link Converter} interface used
* The {@link AddonInfoConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter} interface used
* to convert add-on information within an XML document into a {@link AddonInfoXmlResult} object.
* This converter converts {@code addon} XML tags.
*

View File

@ -22,12 +22,12 @@ import org.openhab.core.addon.AddonInfoList;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link AddonInfoListConverter} is a concrete implementation of the {@code XStream} {@link Converter}
* The {@link AddonInfoListConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter}
* interface used to convert a list of add-on information within an XML document into a list of {@link AddonInfo}
* objects.
*

View File

@ -48,18 +48,6 @@ public class AddonInfoXmlProvider implements XmlDocumentProvider<AddonInfoXmlRes
public AddonInfoXmlProvider(Bundle bundle, XmlAddonInfoProvider addonInfoProvider,
AbstractXmlConfigDescriptionProvider configDescriptionProvider) throws IllegalArgumentException {
if (bundle == null) {
throw new IllegalArgumentException("The Bundle must not be null!");
}
if (addonInfoProvider == null) {
throw new IllegalArgumentException("The XmlAddonInfoProvider must not be null!");
}
if (configDescriptionProvider == null) {
throw new IllegalArgumentException("The XmlConfigDescriptionProvider must not be null!");
}
this.bundle = bundle;
this.addonInfoProvider = addonInfoProvider;
this.configDescriptionProvider = configDescriptionProvider;

View File

@ -16,13 +16,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.addon.AddonInfo;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
/**
* The {@link AddonInfoXmlResult} is an intermediate XML conversion result object which
* contains a mandatory {@link AddonInfo} and an optional {@link ConfigDescription} object.
* <p>
* If a {@link ConfigDescription} object exists, it must be added to the according {@link ConfigDescriptionProvider}.
* If a {@link ConfigDescription} object exists, it must be added to the according
* {@link org.openhab.core.config.core.ConfigDescriptionProvider}.
*
* @author Jan N. Klug - Initial contribution
*/

View File

@ -20,12 +20,12 @@ import org.openhab.core.addon.AddonMatchProperty;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link AddonMatchPropertyConverter} is a concrete implementation of the {@code XStream} {@link Converter}
* The {@link AddonMatchPropertyConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter}
* interface used to convert add-on discovery method match property information within an XML document into a
* {@link AddonMatchProperty} object.
*

View File

@ -16,19 +16,18 @@ import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.addon.AddonMatchProperty;
import org.openhab.core.addon.AddonParameter;
import org.openhab.core.config.core.xml.util.GenericUnmarshaller;
import org.openhab.core.config.core.xml.util.NodeIterator;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
/**
* The {@link AddonParameterConverter} is a concrete implementation of the {@code XStream} {@link Converter}
* The {@link AddonParameterConverter} is a concrete implementation of the {@code XStream}
* {@link com.thoughtworks.xstream.converters.Converter}
* interface used to convert add-on discovery method parameter information within an XML document into a
* {@link AddonMatchProperty} object.
* {@link org.openhab.core.addon.AddonMatchProperty} object.
*
* @author Mark Herwege - Initial contribution
*/

View File

@ -13,7 +13,6 @@
package org.openhab.core.addon.internal.xml;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService;
import org.openhab.core.config.core.xml.AbstractXmlConfigDescriptionProvider;
@ -22,7 +21,7 @@ import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* Provides {@link ConfigDescription}s for bindings which are read from XML files.
* Provides {@link org.openhab.core.config.core.ConfigDescription}s for bindings which are read from XML files.
*
* @author Simon Kaufmann - Initial contribution
* @author Jan N. Klug - Refactored to cover all add-ons