diff --git a/bundles/automation/org.eclipse.smarthome.automation.module.script/src/main/java/org/eclipse/smarthome/automation/module/script/internal/handler/AbstractScriptModuleHandler.java b/bundles/automation/org.eclipse.smarthome.automation.module.script/src/main/java/org/eclipse/smarthome/automation/module/script/internal/handler/AbstractScriptModuleHandler.java index d7e2d202b97..75419cbfe9e 100644 --- a/bundles/automation/org.eclipse.smarthome.automation.module.script/src/main/java/org/eclipse/smarthome/automation/module/script/internal/handler/AbstractScriptModuleHandler.java +++ b/bundles/automation/org.eclipse.smarthome.automation.module.script/src/main/java/org/eclipse/smarthome/automation/module/script/internal/handler/AbstractScriptModuleHandler.java @@ -90,23 +90,25 @@ private Optional createScriptEngine() { private void loadConfig() { Object type = module.getConfiguration().get(SCRIPT_TYPE); Object script = module.getConfiguration().get(SCRIPT); - if (type == null || !(type instanceof String) || ((String) type).trim().isEmpty()) { - throw new RuntimeException( - String.format("Type is missing in the configuration of module '%s'.", module.getId())); - } else if (script == null || !(script instanceof String) || ((String) script).trim().isEmpty()) { - throw new RuntimeException( - String.format("Script is missing in the configuration of module '%s'.", module.getId())); + if (!isValid(type)) { + throw new IllegalStateException(String.format("Type is missing in the configuration of module '%s'.", module.getId())); + } else if (!isValid(script)) { + throw new IllegalStateException(String.format("Script is missing in the configuration of module '%s'.", module.getId())); } else { this.type = (String) type; this.script = (String) script; } } + + private boolean isValid(Object parameter) { + return parameter != null && parameter instanceof String && !((String) parameter).trim().isEmpty(); + } /** * Adds the passed context variables of the rule engine to the context scope of the ScriptEngine, this should be * updated each time the module is executed * - * @param engine the scriptengine that is used + * @param engine the script engine that is used * @param context the variables and types to put into the execution context */ protected void setExecutionContext(ScriptEngine engine, Map context) { diff --git a/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionConverter.java b/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionConverter.java index 079be9ce755..ea79988cd5c 100644 --- a/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionConverter.java +++ b/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionConverter.java @@ -82,7 +82,7 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co // iterate through the nodes, putting the different types into their // respective arrays - while (nodeIterator.hasNext() == true) { + while (nodeIterator.hasNext()) { Object node = nodeIterator.next(); if (node instanceof ConfigDescriptionParameter) { configDescriptionParams.add((ConfigDescriptionParameter) node); diff --git a/bundles/core/org.eclipse.smarthome.core.binding.xml/src/main/java/org/eclipse/smarthome/core/binding/xml/internal/BindingInfoConverter.java b/bundles/core/org.eclipse.smarthome.core.binding.xml/src/main/java/org/eclipse/smarthome/core/binding/xml/internal/BindingInfoConverter.java index e0cac678773..543102a77f6 100644 --- a/bundles/core/org.eclipse.smarthome.core.binding.xml/src/main/java/org/eclipse/smarthome/core/binding/xml/internal/BindingInfoConverter.java +++ b/bundles/core/org.eclipse.smarthome.core.binding.xml/src/main/java/org/eclipse/smarthome/core/binding/xml/internal/BindingInfoConverter.java @@ -55,7 +55,7 @@ private URI readConfigDescriptionURI(NodeIterator nodeIterator) throws Conversio if (uriText != null) { try { return new URI(uriText); - } catch (NullPointerException | URISyntaxException ex) { + } catch (URISyntaxException ex) { throw new ConversionException( "The URI '" + uriText + "' in node " + "'config-description-ref' is invalid!", ex); } diff --git a/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/internal/ThingManager.java b/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/internal/ThingManager.java index 3164d293124..888cc431f3d 100644 --- a/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/internal/ThingManager.java +++ b/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/internal/ThingManager.java @@ -293,7 +293,7 @@ public void migrateThingType(final Thing thing, final ThingTypeUID thingTypeUID, final Configuration configuration) { final ThingType thingType = thingTypeRegistry.getThingType(thingTypeUID); if (thingType == null) { - throw new RuntimeException( + throw new IllegalStateException( MessageFormat.format("No thing type {0} registered, cannot change thing type for thing {1}", thingTypeUID.getAsString(), thing.getUID().getAsString())); } @@ -360,7 +360,7 @@ private void waitUntilHandlerUnregistered(final Thing thing, int timeout) { "Thing type migration failed for {0}. The handler deregistration did not complete within {1}ms.", thing.getUID().getAsString(), timeout); logger.error(message); - throw new RuntimeException(message); + throw new IllegalStateException(message); } private void waitForRunningHandlerRegistrations(ThingUID thingUID) { @@ -379,7 +379,7 @@ private void waitForRunningHandlerRegistrations(ThingUID thingUID) { "Thing type migration failed for {0}. Could not obtain lock for hander registration.", thingUID.getAsString()); logger.error(message); - throw new RuntimeException(message); + throw new IllegalStateException(message); } }, 0, TimeUnit.MILLISECONDS); } diff --git a/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/internal/DialogProcessor.java b/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/internal/DialogProcessor.java index 28222b5f9da..fc923d644d6 100644 --- a/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/internal/DialogProcessor.java +++ b/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/internal/DialogProcessor.java @@ -150,7 +150,7 @@ public void ksEventReceived(KSEvent ksEvent) { @Override public synchronized void sttEventReceived(STTEvent sttEvent) { if (sttEvent instanceof SpeechRecognitionEvent) { - if (false == this.isSTTServerAborting) { + if (!this.isSTTServerAborting) { this.sttServiceHandle.abort(); this.isSTTServerAborting = true; SpeechRecognitionEvent sre = (SpeechRecognitionEvent) sttEvent; @@ -168,7 +168,7 @@ public synchronized void sttEventReceived(STTEvent sttEvent) { } else if (sttEvent instanceof RecognitionStopEvent) { toggleProcessing(false); } else if (sttEvent instanceof SpeechRecognitionErrorEvent) { - if (false == this.isSTTServerAborting) { + if (!this.isSTTServerAborting) { this.sttServiceHandle.abort(); this.isSTTServerAborting = true; toggleProcessing(false); diff --git a/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/ExpressionSequence.java b/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/ExpressionSequence.java index 610e62ffd35..08f427f5913 100644 --- a/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/ExpressionSequence.java +++ b/bundles/core/org.eclipse.smarthome.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/ExpressionSequence.java @@ -71,10 +71,12 @@ List getChildExpressions() { boolean collectFirsts(ResourceBundle language, HashSet firsts) { boolean blocking = false; for (Expression e : subExpressions) { - if ((blocking = e.collectFirsts(language, firsts)) == true) { + blocking = e.collectFirsts(language, firsts); + if (blocking) { break; } } + return blocking; } diff --git a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/items/GenericItem.java b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/items/GenericItem.java index 966416dd4e4..0ff8c546f5f 100644 --- a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/items/GenericItem.java +++ b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/items/GenericItem.java @@ -409,11 +409,10 @@ public void setCategory(@Nullable String category) { * @return true if state is an acceptedDataType or subclass thereof */ public boolean isAcceptedState(List> acceptedDataTypes, State state) { - if (acceptedDataTypes.stream().map(clazz -> clazz.isAssignableFrom(state.getClass())) - .filter(found -> found == true).findAny().isPresent()) { - return true; - } - return false; + return acceptedDataTypes.stream() + .map(clazz -> clazz.isAssignableFrom(state.getClass())) + .filter(found -> found) + .findAny().isPresent(); } protected void logSetTypeError(State state) { diff --git a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/DateTimeType.java b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/DateTimeType.java index 370ec8d3d40..943f7540d2a 100644 --- a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/DateTimeType.java +++ b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/DateTimeType.java @@ -121,11 +121,11 @@ public static DateTimeType valueOf(String value) { @Override public String format(String pattern) { - try { - return String.format(pattern, zonedDateTime); - } catch (NullPointerException npe) { + if (pattern == null) { return DateTimeFormatter.ofPattern(DATE_PATTERN).format(zonedDateTime); } + + return String.format(pattern, zonedDateTime); } public String format(Locale locale, String pattern) { diff --git a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java index f28665936c9..da615ce9b5a 100644 --- a/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java +++ b/bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/library/types/HSBType.java @@ -298,7 +298,7 @@ public PercentType[] toRGB() { blue = b; break; default: - throw new RuntimeException(); + throw new IllegalArgumentException("Could not convert to RGB."); } return new PercentType[] { red, green, blue }; } diff --git a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java index 9c382f57a4f..bfa877ee448 100644 --- a/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java +++ b/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java @@ -397,7 +397,7 @@ private PageDTO createPageBean(String sitemapName, String title, String icon, St private WidgetDTO createWidgetBean(String sitemapName, Widget widget, boolean drillDown, URI uri, String widgetId, Locale locale) { // Test visibility - if (itemUIRegistry.getVisiblity(widget) == false) { + if (!itemUIRegistry.getVisiblity(widget)) { return null; } diff --git a/bundles/io/org.eclipse.smarthome.io.rest/src/main/java/org/eclipse/smarthome/io/rest/JSONResponse.java b/bundles/io/org.eclipse.smarthome.io.rest/src/main/java/org/eclipse/smarthome/io/rest/JSONResponse.java index 14498647c59..d67ddcefa44 100644 --- a/bundles/io/org.eclipse.smarthome.io.rest/src/main/java/org/eclipse/smarthome/io/rest/JSONResponse.java +++ b/bundles/io/org.eclipse.smarthome.io.rest/src/main/java/org/eclipse/smarthome/io/rest/JSONResponse.java @@ -164,7 +164,7 @@ private Response createResponse(Status status, Object entity) { PipedInputStream in = new PipedInputStream(out); rp.entity(in); } catch (IOException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } Thread writerThread = new Thread(() -> { diff --git a/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaOSGiTest.java b/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaOSGiTest.java index c39b1934207..55a7badb95b 100644 --- a/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaOSGiTest.java +++ b/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaOSGiTest.java @@ -135,7 +135,7 @@ private ServiceReference[] getServices(final Class clazz) { .getServiceReferences(clazz.getName(), null); return serviceReferences; } catch (InvalidSyntaxException e) { - throw new Error("Invalid exception for a null filter"); + throw new IllegalArgumentException("Invalid exception for a null filter"); } } diff --git a/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaTest.java b/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaTest.java index a5abc029405..f7a2e3bea7f 100644 --- a/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaTest.java +++ b/bundles/test/org.eclipse.smarthome.test/src/main/java/org/eclipse/smarthome/test/java/JavaTest.java @@ -181,7 +181,7 @@ private void internalSleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { - throw new Error("We shouldn't be interrupted while testing"); + throw new IllegalStateException("We shouldn't be interrupted while testing"); } } diff --git a/bundles/ui/org.eclipse.smarthome.ui/src/main/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImpl.java b/bundles/ui/org.eclipse.smarthome.ui/src/main/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImpl.java index 98274f76d48..94072b827af 100644 --- a/bundles/ui/org.eclipse.smarthome.ui/src/main/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImpl.java +++ b/bundles/ui/org.eclipse.smarthome.ui/src/main/java/org/eclipse/smarthome/ui/internal/items/ItemUIRegistryImpl.java @@ -1065,7 +1065,7 @@ private String processColorDefinition(State state, List colorList) { value = color.getState(); } - if (matchStateToValue(cmpState, value, color.getCondition()) == true) { + if (matchStateToValue(cmpState, value, color.getCondition())) { // We have the color for this value - break! colorString = color.getArg(); break; @@ -1141,7 +1141,7 @@ public boolean getVisiblity(Widget w) { value = rule.getState(); } - if (matchStateToValue(state, value, rule.getCondition()) == true) { + if (matchStateToValue(state, value, rule.getCondition())) { // We have the name for this value! return true; } diff --git a/extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/util/PropertyUtils.java b/extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/util/PropertyUtils.java index 6803d4f9050..db938a1faac 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/util/PropertyUtils.java +++ b/extensions/binding/org.eclipse.smarthome.binding.astro/src/main/java/org/eclipse/smarthome/binding/astro/internal/util/PropertyUtils.java @@ -64,7 +64,7 @@ public static State getState(ChannelUID channelUID, AstroChannelConfig config, O } else if (value instanceof String || value instanceof Enum) { return new StringType(value.toString()); } else { - throw new RuntimeException("Unsupported value type " + value.getClass().getSimpleName()); + throw new IllegalStateException("Unsupported value type " + value.getClass().getSimpleName()); } } diff --git a/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio.test/src/test/java/org/eclipse/smarthome/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java b/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio.test/src/test/java/org/eclipse/smarthome/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java index 8730bdc9d1e..0f6d4ad5b9c 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio.test/src/test/java/org/eclipse/smarthome/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java +++ b/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio.test/src/test/java/org/eclipse/smarthome/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java @@ -197,7 +197,7 @@ public void offlineIfWrongPIN() { String.valueOf(DEFAULT_CONFIG_PROPERTY_PORT), DEFAULT_CONFIG_PROPERTY_REFRESH); initializeRadioThing(config); waitForAssert(() -> { - String exceptionMessage = "java.lang.RuntimeException: Radio does not allow connection, maybe wrong pin?"; + String exceptionMessage = "Radio does not allow connection, maybe wrong pin?"; verifyCommunicationError(exceptionMessage); }); } diff --git a/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioConnection.java b/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioConnection.java index cb1b4b7264d..d0216e53016 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioConnection.java +++ b/extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioConnection.java @@ -93,7 +93,7 @@ public boolean doLogin() throws IOException { String reason = response.getReason(); logger.debug("Communication with radio failed: {} {}", statusCode, reason); if (statusCode == HttpStatus.FORBIDDEN_403) { - throw new RuntimeException("Radio does not allow connection, maybe wrong pin?"); + throw new IllegalStateException("Radio does not allow connection, maybe wrong pin?"); } throw new IOException("Communication with radio failed, return code: " + statusCode); } diff --git a/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/handler/HueBridgeHandler.java b/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/handler/HueBridgeHandler.java index b1a663735b6..12698606fe0 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/handler/HueBridgeHandler.java +++ b/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/handler/HueBridgeHandler.java @@ -515,16 +515,19 @@ private boolean isEqual(State state1, State state2) { boolean colorModeIsEqual = true; boolean effectIsEqual = true; - try { - colorModeIsEqual = state1.getColorMode().equals(state2.getColorMode()); - } catch (NullPointerException npe) { + + if (state1.getColorMode() == null) { logger.trace("Light does not support color mode."); + } else { + colorModeIsEqual = state1.getColorMode().equals(state2.getColorMode()); } - try { - effectIsEqual = state1.getEffect().equals(state2.getEffect()); - } catch (NullPointerException npe) { + + if (state1.getEffect() == null) { logger.trace("Light does not support effect."); + } else { + effectIsEqual = state1.getEffect().equals(state2.getEffect()); } + return colorModeIsEqual && effectIsEqual; } diff --git a/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueBridge.java b/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueBridge.java index 7c679994a45..2d4595e3b84 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueBridge.java +++ b/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueBridge.java @@ -873,6 +873,10 @@ private void handleErrors(Result result) throws IOException, ApiException { } for (ErrorResponse error : errors) { + if (error == null) { + continue; + } + switch (error.getType()) { case 1: username = null; @@ -893,8 +897,6 @@ private void handleErrors(Result result) throws IOException, ApiException { } } catch (JsonParseException e) { // Not an error - } catch (NullPointerException e) { - // Object that looks like error } } } diff --git a/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/handler/WemoLightHandler.java b/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/handler/WemoLightHandler.java index 24a8a86904b..351c74a07ff 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/handler/WemoLightHandler.java +++ b/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/handler/WemoLightHandler.java @@ -280,7 +280,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { } } } catch (Exception e) { - throw new RuntimeException("Could not send command to WeMo Bridge", e); + throw new IllegalStateException("Could not send command to WeMo Bridge", e); } } } @@ -339,7 +339,7 @@ public void getDeviceState() { } } } catch (Exception e) { - throw new RuntimeException("Could not retrieve new Wemo light state", e); + throw new IllegalStateException("Could not retrieve new Wemo light state", e); } } diff --git a/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/internal/http/WemoHttpCall.java b/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/internal/http/WemoHttpCall.java index 3a25cc3efbc..3e32f248de7 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/internal/http/WemoHttpCall.java +++ b/extensions/binding/org.eclipse.smarthome.binding.wemo/src/main/java/org/eclipse/smarthome/binding/wemo/internal/http/WemoHttpCall.java @@ -40,7 +40,7 @@ public static String executeCall(String wemoURL, String soapHeader, String conte String wemoCallResponse = HttpUtil.executeUrl("POST", wemoURL, wemoHeaders, wemoContent, null, 2000); return wemoCallResponse; } catch (Exception e) { - throw new RuntimeException("Could not call WeMo", e); + throw new IllegalStateException("Could not call WeMo", e); } } diff --git a/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/render/PageRenderer.java b/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/render/PageRenderer.java index a7dadacfa29..ce396a984e9 100644 --- a/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/render/PageRenderer.java +++ b/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/render/PageRenderer.java @@ -162,7 +162,7 @@ private void processChildren(StringBuilder sb_pre, StringBuilder sb_post, EList< @Override public EList renderWidget(Widget w, StringBuilder sb) throws RenderException { // Check if this widget is visible - if (itemUIRegistry.getVisiblity(w) == false) { + if (!itemUIRegistry.getVisiblity(w)) { return null; } diff --git a/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/servlet/WebAppServlet.java b/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/servlet/WebAppServlet.java index c0dfa1e96d2..0a7cb1de640 100644 --- a/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/servlet/WebAppServlet.java +++ b/extensions/ui/org.eclipse.smarthome.ui.classic/src/main/java/org/eclipse/smarthome/ui/classic/internal/servlet/WebAppServlet.java @@ -141,7 +141,7 @@ public void service(ServletRequest req, ServletResponse res) throws ServletExcep // we are at the homepage, so we render the children of the sitemap root node String label = sitemap.getLabel() != null ? sitemap.getLabel() : sitemapName; EList children = renderer.getItemUIRegistry().getChildren(sitemap); - if (poll && waitForChanges(children) == false) { + if (!(poll && waitForChanges(children))) { // we have reached the timeout, so we do not return any content as nothing has changed res.getWriter().append(getTimeoutResponse()).close(); return; @@ -159,7 +159,7 @@ public void service(ServletRequest req, ServletResponse res) throws ServletExcep EList parentAndChildren = new BasicEList(); parentAndChildren.add(lw); parentAndChildren.addAll(children); - if (poll && waitForChanges(parentAndChildren) == false) { + if (!(poll && waitForChanges(parentAndChildren))) { // we have reached the timeout, so we do not return any content as nothing has changed res.getWriter().append(getTimeoutResponse()).close(); return; diff --git a/tools/static-code-analysis/pmd/suppressions.properties b/tools/static-code-analysis/pmd/suppressions.properties index cd7d4bd95a9..2dc0ca666ce 100644 --- a/tools/static-code-analysis/pmd/suppressions.properties +++ b/tools/static-code-analysis/pmd/suppressions.properties @@ -3,3 +3,8 @@ org.eclipse.smarthome.io.console.karaf.internal.OSGiConsole=SystemPrintln org.eclipse.smarthome.io.console.rfc147.internal.CommandWrapper=SystemPrintln org.eclipse.smarthome.io.console.rfc147.internal.OSGiConsole=SystemPrintln org.eclipse.smarthome.core.internal.events.ThreadedEventHandler=EmptyIfStmt +org.eclipse.smarthome.config.xml.ConfigDescriptionConverter=AvoidCatchingNPE +org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource=AvoidCatchingNPE +org.eclipse.smarthome.test.java.JavaTest=AvoidCatchingNPE +org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl=AvoidCatchingNPE +org.eclipse.smarthome.io.net.http.internal.SecureHttpClientFactory=AvoidThrowingRawExceptionTypes