Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Sep 9, 2021
1 parent 2004031 commit 571c842
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/weasis/dicom/web/ContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ static ContentType probe(Path path) {
throw new IOException(
String.format("failed to determine content type of file: '%s'", path));
}
switch (type.toLowerCase()) {
case "application/dicom":
return ContentType.APPLICATION_DICOM;
if ("application/dicom".equalsIgnoreCase(type)) {
return ContentType.APPLICATION_DICOM;
}
throw new UnsupportedOperationException(
String.format("unsupported content type: '%s' of file: '%s'", type, path));
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/org/weasis/dicom/web/DicomStowRS.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.InputStream;
import java.io.SequenceInputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
Expand Down Expand Up @@ -72,7 +73,6 @@ public String toString() {
private final String requestURL;
private final String agentName;
private final Map<String, String> headers;
private boolean photo = false;
private final HttpContentType type = HttpContentType.XML;
private final HttpClient client;
private final ExecutorService executorService;
Expand All @@ -82,7 +82,6 @@ public String toString() {
* @param contentType the value of the type in the Content-Type HTTP property
* @param agentName the value of the User-Agent HTTP property
* @param headers some additional header properties.
* @throws IOException Exception during the POST initialization
*/
public DicomStowRS(
String requestURL, ContentType contentType, String agentName, Map<String, String> headers) {
Expand Down Expand Up @@ -112,7 +111,7 @@ private String getFinalUrl(String requestURL) {
}

protected HttpRequest buildConnection(Flow.Publisher<? extends ByteBuffer> multipartSubscriber)
throws Exception {
throws URISyntaxException {
ContentType partType = ContentType.APPLICATION_DICOM;
HttpRequest.Builder builder = buidDefaultConnection();

Expand Down Expand Up @@ -193,9 +192,7 @@ <T> HttpResponse<T> send(
}

private static void promptHeaders(String prefix, HttpHeaders headers) {
headers
.map()
.forEach((k, v) -> v.stream().forEach(v1 -> LOGGER.debug("{} {}: {}", prefix, k, v1)));
headers.map().forEach((k, v) -> v.forEach(v1 -> LOGGER.debug("{} {}: {}", prefix, k, v1)));
LOGGER.debug(prefix);
}

Expand All @@ -214,10 +211,6 @@ public Map<String, String> getHeaders() {
return headers;
}

public boolean isPhoto() {
return photo;
}

public void uploadDicom(Path path) throws HttpException {
Payload playload =
new Payload() {
Expand Down

0 comments on commit 571c842

Please sign in to comment.