Skip to content

Commit 517a912

Browse files
Merge branch 'dev' into df/#809_cleanup
2 parents efc7b6a + 6c0aabb commit 517a912

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased/Snapshot]
88

9+
### Added
10+
11+
### Fixed
12+
13+
### Changed
14+
- `SqlIdCoordinateSource.createCooridinateValue` now throws an exception when the coordinate can not be built [#911](https://github.com/ie3-institute/PowerSystemDataModel/issues/911)
15+
916
## [4.0.0] - 2023-08-01
1017

1118
### Added

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ plugins {
44
id 'maven-publish'
55
id 'signing'
66
id 'pmd' // code check, working on source code
7-
id 'com.diffplug.spotless' version '6.21.0'//code format
8-
id 'com.github.spotbugs' version '5.1.3' // code check, working on byte code
7+
id 'com.diffplug.spotless' version '6.22.0'//code format
8+
id 'com.github.spotbugs' version '5.2.0' // code check, working on byte code
99
id 'de.undercouch.download' version '5.5.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
1111
id 'jacoco' // java code coverage plugin
12-
id "org.sonarqube" version "4.4.0.3356" // sonarqube
12+
id "org.sonarqube" version "4.4.1.3373" // sonarqube
1313
id 'net.thauvin.erik.gradle.semver' version '1.0.4' // semantic versioning
1414
}
1515

@@ -87,7 +87,7 @@ dependencies {
8787

8888
// Databases
8989
implementation 'org.influxdb:influxdb-java:2.23'
90-
implementation 'com.couchbase.client:java-client:3.4.10'
90+
implementation 'com.couchbase.client:java-client:3.4.11'
9191
runtimeOnly 'org.postgresql:postgresql:42.6.0' // postgresql jdbc driver required during runtime
9292

9393
implementation 'commons-io:commons-io:2.14.0' // I/O functionalities

src/main/java/edu/ie3/datamodel/io/source/sql/SqlIdCoordinateSource.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,27 +173,18 @@ public List<CoordinateDistance> getClosestCoordinates(
173173

174174
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
175175

176-
private Optional<CoordinateValue> createCoordinateValue(Map<String, String> fieldToValues) {
176+
private CoordinateValue createCoordinateValue(Map<String, String> fieldToValues) {
177177
fieldToValues.remove("distance");
178178

179179
SimpleFactoryData simpleFactoryData = new SimpleFactoryData(fieldToValues, Pair.class);
180-
Optional<Pair<Integer, Point>> pair = factory.get(simpleFactoryData).getData();
181180

182-
if (pair.isEmpty()) {
183-
return Optional.empty();
184-
} else {
185-
Pair<Integer, Point> data = pair.get();
186-
return Optional.of(new CoordinateValue(data.getKey(), data.getValue()));
187-
}
181+
Pair<Integer, Point> pair = factory.get(simpleFactoryData).getOrThrow();
182+
return new CoordinateValue(pair.getKey(), pair.getValue());
188183
}
189184

190185
private List<CoordinateValue> executeQueryToList(
191186
String query, SqlDataSource.AddParams addParams) {
192-
return dataSource
193-
.executeQuery(query, addParams)
194-
.map(this::createCoordinateValue)
195-
.flatMap(Optional::stream)
196-
.toList();
187+
return dataSource.executeQuery(query, addParams).map(this::createCoordinateValue).toList();
197188
}
198189

199190
/**

0 commit comments

Comments
 (0)