[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -291,8 +291,8 @@ public abstract class CommandHandler {
|
||||
}
|
||||
|
||||
private int getRampLevel(InsteonChannelConfiguration conf, int defaultValue) {
|
||||
Map<String, @Nullable String> params = conf.getParameters();
|
||||
return params.containsKey("ramplevel") ? Integer.parseInt(params.get("ramplevel")) : defaultValue;
|
||||
String str = conf.getParameters().get("ramplevel");
|
||||
return str != null ? Integer.parseInt(str) : defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,8 +642,8 @@ public abstract class CommandHandler {
|
||||
}
|
||||
|
||||
protected double getRampTime(InsteonChannelConfiguration conf, double defaultValue) {
|
||||
Map<String, @Nullable String> params = conf.getParameters();
|
||||
return params.containsKey("ramptime") ? Double.parseDouble(params.get("ramptime")) : defaultValue;
|
||||
String str = conf.getParameters().get("ramptime");
|
||||
return str != null ? Double.parseDouble(str) : defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,9 +159,8 @@ public abstract class MessageHandler {
|
||||
*/
|
||||
protected double getDoubleParameter(String key, double def) {
|
||||
try {
|
||||
if (parameters.get(key) != null) {
|
||||
return Double.parseDouble(parameters.get(key));
|
||||
}
|
||||
String str = parameters.get(key);
|
||||
return str != null ? Double.parseDouble(str) : def;
|
||||
} catch (NumberFormatException e) {
|
||||
logger.warn("malformed int parameter in message handler: {}", key);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,9 @@ public class ReadByteBuffer {
|
||||
}
|
||||
|
||||
int b = Math.min(len, remaining());
|
||||
System.arraycopy(buf, index, bytes, off, b);
|
||||
if (bytes != null) {
|
||||
System.arraycopy(buf, index, bytes, off, b);
|
||||
}
|
||||
index += b;
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -280,12 +280,13 @@ public class Msg {
|
||||
* @param len the length to copy from the src byte array
|
||||
*/
|
||||
private void initialize(byte[] newData, int offset, int len) {
|
||||
data = new byte[len];
|
||||
byte[] data = new byte[len];
|
||||
if (offset >= 0 && offset < newData.length) {
|
||||
System.arraycopy(newData, offset, data, 0, len);
|
||||
} else {
|
||||
logger.warn("intialize(): Offset out of bounds!");
|
||||
}
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,7 +345,10 @@ public class Msg {
|
||||
throw new FieldException("data index out of bounds!");
|
||||
}
|
||||
byte[] section = new byte[numBytes];
|
||||
System.arraycopy(data, offset, section, 0, numBytes);
|
||||
byte[] data = this.data;
|
||||
if (data != null) {
|
||||
System.arraycopy(data, offset, section, 0, numBytes);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user