Skip to content

Commit ff1b646

Browse files
committed
Fixes NullPointerException in SunTimesProvider
Updates dependencies
1 parent 9912445 commit ff1b646

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

.mvn/wrapper/maven-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
22
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

33
## [Unreleased]
4+
5+
## [0.7.1] - 2022-12-19
6+
7+
- Fixes NullPointerException in SunTimesProvider
8+
- Updates dependencies
49

510
## [0.7.0] - 2021-05-14
611

pom.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>at.sv.hue</groupId>
88
<artifactId>hue-scheduler</artifactId>
9-
<version>0.7.0</version>
9+
<version>0.7.1</version>
1010

1111
<scm>
1212
<connection>scm:git:[email protected]:stefanvictora/hue-scheduler.git</connection>
@@ -32,34 +32,34 @@
3232
<dependency>
3333
<groupId>com.fasterxml.jackson.core</groupId>
3434
<artifactId>jackson-databind</artifactId>
35-
<version>2.12.3</version>
35+
<version>2.14.1</version>
3636
</dependency>
3737
<dependency>
3838
<groupId>ch.qos.logback</groupId>
3939
<artifactId>logback-classic</artifactId>
40-
<version>1.2.3</version>
40+
<version>1.4.5</version>
4141
</dependency>
4242
<dependency>
4343
<groupId>org.shredzone.commons</groupId>
4444
<artifactId>commons-suncalc</artifactId>
45-
<version>3.4</version>
45+
<version>3.5</version>
4646
</dependency>
4747
<dependency>
4848
<groupId>info.picocli</groupId>
4949
<artifactId>picocli</artifactId>
50-
<version>4.6.1</version>
50+
<version>4.7.0</version>
5151
</dependency>
5252

5353
<dependency>
5454
<groupId>org.junit.jupiter</groupId>
5555
<artifactId>junit-jupiter</artifactId>
56-
<version>5.7.1</version>
56+
<version>5.9.1</version>
5757
<scope>test</scope>
5858
</dependency>
5959
<dependency>
6060
<groupId>org.junit.jupiter</groupId>
6161
<artifactId>junit-jupiter-engine</artifactId>
62-
<version>5.7.1</version>
62+
<version>5.9.1</version>
6363
<scope>test</scope>
6464
</dependency>
6565
<dependency>

src/main/java/at/sv/hue/HueScheduler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import java.util.function.Supplier;
2828
import java.util.stream.Collectors;
2929

30-
@Command(name = "HueScheduler", version = "0.7.0", mixinStandardHelpOptions = true, sortOptions = false)
30+
@Command(name = "HueScheduler", version = "0.7.1", mixinStandardHelpOptions = true, sortOptions = false)
3131
public final class HueScheduler implements Runnable {
3232

3333
private static final Logger LOG = LoggerFactory.getLogger(HueScheduler.class);

src/main/java/at/sv/hue/time/SunTimesProviderImpl.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ public final class SunTimesProviderImpl implements SunTimesProvider {
1010

1111
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
1212

13-
private final SunTimes.Parameters parameters;
13+
private final double lat;
14+
private final double lng;
15+
private final double height;
1416

1517
public SunTimesProviderImpl(double lat, double lng, double height) {
16-
parameters = SunTimes.compute().at(lat, lng).height(height);
18+
this.lat = lat;
19+
this.lng = lng;
20+
this.height = height;
1721
}
1822

1923
@Override
@@ -80,7 +84,7 @@ private SunTimes sunTimesFor(ZonedDateTime dateTime, SunTimes.Twilight twilight)
8084
}
8185

8286
private SunTimes.Parameters getProviderFor(ZonedDateTime dateTime) {
83-
return parameters.on(dateTime.with(LocalTime.MIDNIGHT));
87+
return SunTimes.compute().at(lat, lng).height(height).on(dateTime.with(LocalTime.MIDNIGHT));
8488
}
8589

8690
@Override

0 commit comments

Comments
 (0)