Skip to content

Commit

Permalink
Merge branch 'dev-v2' into fix-148-add-doip-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Pfeil committed Sep 1, 2023
2 parents 63690f3 + 46f4733 commit 4ab7034
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ plugins {
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/
id 'org.springframework.boot' version '2.7.13'
// https://docs.spring.io/dependency-management-plugin/docs/current-SNAPSHOT/reference/html/
id "io.spring.dependency-management" version "1.1.2"
id "io.spring.dependency-management" version "1.1.3"
// Lombok generates getter and setter and more. https://projectlombok.org/
// check for new versions here: https://plugins.gradle.org/plugin/io.freefair.lombok
id "io.freefair.lombok" version "8.1.0"
id "io.freefair.lombok" version "8.3"
// Release tagging with `./gradlew release`
// Check for new versions here: https://plugins.gradle.org/plugin/net.researchgate.release
// Usage: https://github.com/researchgate/gradle-release
Expand All @@ -20,7 +20,7 @@ plugins {
// Adds coveralls task for CI to send results to the coveralls service.
id "com.github.kt3k.coveralls" version "2.12.2"
//id "com.github.kt3k.coveralls" version "2.12.0"
id "org.owasp.dependencycheck" version "8.3.1"
id "org.owasp.dependencycheck" version "8.4.0"
id 'org.asciidoctor.jvm.convert' version '3.3.2'
// include build and git information via Spring Actuator
id "com.gorylenko.gradle-git-properties" version "2.4.1"
Expand Down Expand Up @@ -60,7 +60,7 @@ dependencies {
implementation("edu.kit.datamanager:service-base:1.1.1")
implementation("edu.kit.datamanager:repo-core:1.1.2")
// com.google.common, LoadingCache
implementation("com.google.guava:guava:32.1.1-jre")
implementation("com.google.guava:guava:32.1.2-jre")
// Required by Spring/Javers at runtime
implementation 'com.google.code.gson:gson:2.10.1'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"

version=2.0.0
version=1.1.2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ResponseStatusException;

import edu.kit.datamanager.pit.common.ExternalServiceException;
import edu.kit.datamanager.pit.common.InvalidConfigException;
import edu.kit.datamanager.pit.common.PidAlreadyExistsException;
Expand Down Expand Up @@ -215,12 +218,23 @@ public String registerPidUnchecked(final PIDRecord pidRecord) throws PidAlreadyE
// TODO add options to add additional adminValues e.g. for user lists?
ArrayList<HandleValue> admin = new ArrayList<>();
admin.add(this.adminValue);
ArrayList<HandleValue> recordValues = this.handleValuesFrom(pidRecord, Optional.of(admin));

HandleValue[] values = recordValues.toArray(new HandleValue[] {});
ArrayList<HandleValue> futurePairs = this.handleValuesFrom(pidRecord, Optional.of(admin));

HandleValue[] futurePairsArray = futurePairs.toArray(new HandleValue[] {});
// Sanity check. Should never fail. Will throw runtime exception in this case.
if (futurePairsArray.length < pidRecord.getEntries().keySet().size()) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
String.format(
"Error extracting pairs from record. Extracted %d from at least %d",
futurePairsArray.length,
pidRecord.getEntries().keySet().size()
)
);
}

try {
this.client.createHandle(pidRecord.getPid(), values);
this.client.createHandle(pidRecord.getPid(), futurePairsArray);
} catch (HandleException e) {
if (e.getCode() == HandleException.HANDLE_ALREADY_EXISTS) {
// Should not happen as this has to be checked on the REST handler level.
Expand Down

0 comments on commit 4ab7034

Please sign in to comment.