mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Fix warnings and handle deprecations (#5421)
* Fix warnings and handle deprecations * Potential fix for pull request finding Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
+2
-1
@@ -125,7 +125,7 @@ public class ThingStatusConditionHandler extends BaseConditionModuleHandler impl
|
||||
|
||||
if (thing == null) {
|
||||
logger.error("Thing with UID {} not found in ThingRegistry for condition of rule {}.", thingUID, ruleUID);
|
||||
} else
|
||||
} else {
|
||||
switch (operator) {
|
||||
case "=":
|
||||
return thing.getStatus().equals(status);
|
||||
@@ -134,6 +134,7 @@ public class ThingStatusConditionHandler extends BaseConditionModuleHandler impl
|
||||
default:
|
||||
logger.error("Thing status condition operator {} is not known of rule {}", operator, ruleUID);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -110,6 +110,10 @@ public class CertificateGenerator implements BundleActivator {
|
||||
*/
|
||||
private KeyStore ensureKeystore() throws KeyStoreException {
|
||||
String keystorePath = System.getProperty(JETTY_KEYSTORE_PATH_PROPERTY);
|
||||
if (keystorePath == null || keystorePath.isEmpty()) {
|
||||
throw new KeyStoreException(
|
||||
"Keystore path system property '" + JETTY_KEYSTORE_PATH_PROPERTY + "' is not set.");
|
||||
}
|
||||
keystoreFile = new File(keystorePath);
|
||||
KeyStore keyStore = KeyStore.getInstance(KEYSTORE_JKS_TYPE);
|
||||
if (!keystoreFile.exists()) {
|
||||
@@ -184,7 +188,7 @@ public class CertificateGenerator implements BundleActivator {
|
||||
X500Name subjectDN = new X500Name(X500_NAME);
|
||||
byte[] publickeyb = publicKey.getEncoded();
|
||||
ASN1Sequence sequence = (ASN1Sequence) ASN1Primitive.fromByteArray(publickeyb);
|
||||
SubjectPublicKeyInfo subPubKeyInfo = new SubjectPublicKeyInfo(sequence);
|
||||
SubjectPublicKeyInfo subPubKeyInfo = SubjectPublicKeyInfo.getInstance(sequence);
|
||||
X509v3CertificateBuilder v3CertGen = new X509v3CertificateBuilder(issuerDN, serialNumber, notBefore,
|
||||
notAfter, subjectDN, subPubKeyInfo);
|
||||
|
||||
|
||||
+8
-1
@@ -27,7 +27,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.audio.*;
|
||||
import org.openhab.core.audio.AudioFormat;
|
||||
import org.openhab.core.audio.AudioSink;
|
||||
import org.openhab.core.audio.AudioStream;
|
||||
import org.openhab.core.audio.FixedLengthAudioStream;
|
||||
import org.openhab.core.audio.PipedAudioStream;
|
||||
import org.openhab.core.audio.SizeableAudioStream;
|
||||
import org.openhab.core.audio.UnsupportedAudioFormatException;
|
||||
import org.openhab.core.audio.UnsupportedAudioStreamException;
|
||||
import org.openhab.core.audio.utils.AudioWaveUtils;
|
||||
import org.openhab.core.library.types.PercentType;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+5
-1
@@ -25,7 +25,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.audio.*;
|
||||
import org.openhab.core.audio.AudioException;
|
||||
import org.openhab.core.audio.AudioFormat;
|
||||
import org.openhab.core.audio.AudioSource;
|
||||
import org.openhab.core.audio.AudioStream;
|
||||
import org.openhab.core.audio.PipedAudioStream;
|
||||
import org.openhab.core.common.ThreadPoolManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
+2
-1
@@ -171,8 +171,9 @@ public class ChannelTransformation {
|
||||
} catch (TransformationException e) {
|
||||
if (e.getCause() instanceof ScriptException ex) {
|
||||
logger.error("Applying {} failed: {}", this, ex.getMessage());
|
||||
} else
|
||||
} else {
|
||||
logger.debug("Applying {} failed: {}", this, e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.warn("Failed to use {}, service not found", this);
|
||||
|
||||
@@ -59,8 +59,8 @@ class GsonTest {
|
||||
assertNotNull(json, "JSON content should not be null");
|
||||
assertFalse(json.isEmpty(), "JSON content should not be empty");
|
||||
|
||||
// Deserialize into GsonTestClass_DTO
|
||||
GsonTestClass_DTO test = GSON.fromJson(json, GsonTestClass_DTO.class);
|
||||
// Deserialize into GsonTestClassDTO
|
||||
GsonTestClassDTO test = GSON.fromJson(json, GsonTestClassDTO.class);
|
||||
assertNotNull(test, "Deserialized object should not be null");
|
||||
|
||||
// Verify all fields are correctly deserialized
|
||||
@@ -77,8 +77,8 @@ class GsonTest {
|
||||
assertNotNull(json, "JSON content should not be null");
|
||||
assertFalse(json.isEmpty(), "JSON content should not be empty");
|
||||
|
||||
// Deserialize into GsonTestClassAnnotated_DTO
|
||||
GsonTestClassAnnotated_DTO test = GSON.fromJson(json, GsonTestClassAnnotated_DTO.class);
|
||||
// Deserialize into GsonTestClassAnnotatedDTO
|
||||
GsonTestClassAnnotatedDTO test = GSON.fromJson(json, GsonTestClassAnnotatedDTO.class);
|
||||
assertNotNull(test, "Deserialized object should not be null");
|
||||
|
||||
// Verify all fields are correctly deserialized
|
||||
@@ -95,8 +95,8 @@ class GsonTest {
|
||||
assertNotNull(json, "JSON content should not be null");
|
||||
assertFalse(json.isEmpty(), "JSON content should not be empty");
|
||||
|
||||
// Deserialize into GsonTestClassAnnotated2_DTO
|
||||
GsonTestClassAnnotated2_DTO test = GSON.fromJson(json, GsonTestClassAnnotated2_DTO.class);
|
||||
// Deserialize into GsonTestClassAnnotated2DTO
|
||||
GsonTestClassAnnotated2DTO test = GSON.fromJson(json, GsonTestClassAnnotated2DTO.class);
|
||||
assertNotNull(test, "Deserialized object should not be null");
|
||||
|
||||
// Verify all fields are correctly deserialized
|
||||
|
||||
+4
-4
@@ -23,16 +23,16 @@ import com.google.gson.annotations.SerializedName;
|
||||
* @author Holger Friedrich - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class GsonTestClassAnnotated2_DTO {
|
||||
public class GsonTestClassAnnotated2DTO {
|
||||
public @SerializedName("name") @Nullable String n;
|
||||
public @Nullable @SerializedName("email") String e;
|
||||
public int age;
|
||||
public boolean active;
|
||||
|
||||
public GsonTestClassAnnotated2_DTO() {
|
||||
public GsonTestClassAnnotated2DTO() {
|
||||
}
|
||||
|
||||
public GsonTestClassAnnotated2_DTO(String name, int age, String email, boolean active) {
|
||||
public GsonTestClassAnnotated2DTO(String name, int age, String email, boolean active) {
|
||||
this.n = name;
|
||||
this.e = email;
|
||||
this.age = age;
|
||||
@@ -41,7 +41,7 @@ public class GsonTestClassAnnotated2_DTO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GsonTestClassAnnotated2_DTO{" + "name='" + n + '\'' + ", age=" + age + ", email='" + e + '\''
|
||||
return "GsonTestClassAnnotated2DTO{" + "name='" + n + '\'' + ", age=" + age + ", email='" + e + '\''
|
||||
+ ", active=" + active + '}';
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -22,17 +22,17 @@ import com.google.gson.annotations.SerializedName;
|
||||
* @author Holger Friedrich - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class GsonTestClassAnnotated_DTO {
|
||||
public class GsonTestClassAnnotatedDTO {
|
||||
// adding annotations in different order is intended, please do not sort!
|
||||
public @SerializedName("name") @NonNullByDefault({}) String n = null;
|
||||
public @NonNullByDefault({}) @SerializedName("email") String e = null;
|
||||
public int age;
|
||||
public boolean active;
|
||||
|
||||
public GsonTestClassAnnotated_DTO() {
|
||||
public GsonTestClassAnnotatedDTO() {
|
||||
}
|
||||
|
||||
public GsonTestClassAnnotated_DTO(String name, int age, String email, boolean active) {
|
||||
public GsonTestClassAnnotatedDTO(String name, int age, String email, boolean active) {
|
||||
this.n = name;
|
||||
this.e = email;
|
||||
this.age = age;
|
||||
@@ -41,7 +41,7 @@ public class GsonTestClassAnnotated_DTO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GsonTestClassAnnotated_DTO{" + "name='" + n + '\'' + ", age=" + age + ", email='" + e + '\''
|
||||
return "GsonTestClassAnnotatedDTO{" + "name='" + n + '\'' + ", age=" + age + ", email='" + e + '\''
|
||||
+ ", active=" + active + '}';
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -17,16 +17,16 @@ package org.openhab.core.gson;
|
||||
*
|
||||
* @author Holger Friedrich - Initial contribution
|
||||
*/
|
||||
public class GsonTestClass_DTO {
|
||||
public class GsonTestClassDTO {
|
||||
public String name;
|
||||
public int age;
|
||||
public String email;
|
||||
public boolean active;
|
||||
|
||||
public GsonTestClass_DTO() {
|
||||
public GsonTestClassDTO() {
|
||||
}
|
||||
|
||||
public GsonTestClass_DTO(String name, int age, String email, boolean active) {
|
||||
public GsonTestClassDTO(String name, int age, String email, boolean active) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
this.email = email;
|
||||
Reference in New Issue
Block a user