Java 17 features (T-Z) (#15576)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings - remove null check before instanceof Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -81,8 +81,8 @@ public class XmlTVDiscoveryService extends AbstractDiscoveryService implements T
|
||||
|
||||
@Override
|
||||
public void setThingHandler(ThingHandler handler) {
|
||||
if (handler instanceof XmlTVHandler) {
|
||||
this.handler = (XmlTVHandler) handler;
|
||||
if (handler instanceof XmlTVHandler tvHandler) {
|
||||
this.handler = tvHandler;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
package org.openhab.binding.xmltv.internal.handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.time.Instant;
|
||||
@@ -77,7 +76,7 @@ public class XmlTVHandler extends BaseBridgeHandler {
|
||||
XMLStreamReader xsr = null;
|
||||
try {
|
||||
// This can take some seconds depending upon weight of the XmlTV source file
|
||||
xsr = xif.createXMLStreamReader(new FileInputStream(new File(config.filePath)), config.encoding);
|
||||
xsr = xif.createXMLStreamReader(new FileInputStream(config.filePath), config.encoding);
|
||||
try {
|
||||
Tv xmlFile = (Tv) unmarshaller.unmarshal(xsr);
|
||||
// Remove all finished programmes
|
||||
|
||||
@@ -77,8 +77,7 @@ public class Programme {
|
||||
}
|
||||
|
||||
private long iso860DateToEpoch(String date) {
|
||||
long epoch = ZonedDateTime.parse(date, XMLTV_DATE_FORMAT).toInstant().toEpochMilli();
|
||||
return epoch;
|
||||
return ZonedDateTime.parse(date, XMLTV_DATE_FORMAT).toInstant().toEpochMilli();
|
||||
}
|
||||
|
||||
public List<Icon> getIcons() {
|
||||
|
||||
Reference in New Issue
Block a user