mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-11 05:41:52 +01:00
Added nullness annotations to fix NPE in HttpServiceUtil (#2234)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
e20348e8d6
commit
26e9a8ed9c
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package org.openhab.core.net;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.Constants;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Markus Rathgeb - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class HttpServiceUtil {
|
||||
|
||||
private HttpServiceUtil() {
|
||||
@ -45,9 +47,6 @@ public class HttpServiceUtil {
|
||||
|
||||
// Utility method that could be used for non-secure and secure port.
|
||||
private static int getHttpServicePortProperty(final BundleContext bc, final String propertyName) {
|
||||
Object value;
|
||||
int port = -1;
|
||||
|
||||
// Try to find the port by using the service property (respect service ranking).
|
||||
final ServiceReference<?>[] refs;
|
||||
try {
|
||||
@ -59,6 +58,9 @@ public class HttpServiceUtil {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Object value;
|
||||
int port = -1;
|
||||
|
||||
if (refs != null) {
|
||||
int candidate = Integer.MIN_VALUE;
|
||||
for (final ServiceReference<?> ref : refs) {
|
||||
|
Loading…
Reference in New Issue
Block a user