Skip to content

Commit f1abd2b

Browse files
committed
Minor change for profile check in formatter
1 parent 61cc6f5 commit f1abd2b

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

src/main/java/edu/kit/scc/dem/wapsrv/model/formats/JsonLdFormatter.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package edu.kit.scc.dem.wapsrv.model.formats;
22

33
import java.io.IOException;
4-
import java.net.MalformedURLException;
54
import java.net.URI;
65
import java.net.URISyntaxException;
7-
import java.net.URL;
86
import java.util.*;
97
import java.util.regex.Pattern;
108
import org.apache.commons.collections4.map.ListOrderedMap;
@@ -71,22 +69,6 @@ public JsonLdFormatter() {
7169
super(Format.JSON_LD);
7270
}
7371

74-
/**
75-
* This is a helper method necessary to be able to use a static URL,
76-
* otherwise the exception can not be caught.
77-
*
78-
* @param urlString The String to generate a URL from
79-
* @return The generated URL Object
80-
*/
81-
private static URL makeUrl(String urlString) {
82-
try {
83-
return new URL(urlString);
84-
} catch (MalformedURLException e) {
85-
LoggerFactory.getLogger(ContentNegotiator.class).error("DEFAULT_PROFILE is an invalid URL : " + urlString);
86-
return null;
87-
}
88-
}
89-
9072
/**
9173
* This is a helper method necessary to be able to use a static URL,
9274
* otherwise the exception can not be caught.
@@ -375,15 +357,12 @@ public void setAcceptPart(String profilesRaw, Type type) {
375357
// The default profiles are always added if no accept header is given at all
376358
if (profilesRaw == null || WapServerConfig.getInstance().shouldAlwaysAddDefaultProfilesToJsonLdRequests()) {
377359
switch (type) {
360+
//TODO: check if this behaviour is working as intended
378361
case CONTAINER:
379-
if (!profiles.contains(LDP_PROFILE)) {
380-
profiles.add(LDP_PROFILE);
381-
}
362+
profiles.add(LDP_PROFILE);
382363
case ANNOTATION:
383364
case PAGE:
384-
if (!profiles.contains(DEFAULT_PROFILE)) {
385-
profiles.add(DEFAULT_PROFILE);
386-
}
365+
profiles.add(DEFAULT_PROFILE);
387366
break;
388367
default:
389368
// Unknown type ? do nothing because profile negotiation can be ignored by the server

0 commit comments

Comments
 (0)