Skip to content

Commit

Permalink
refactor: sonarLint 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
BGuga committed Sep 3, 2023
1 parent 22f500e commit 354b0ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private Optional<URL> findFileURL(String resourcePath) {
}
return Optional.of(resourceURL);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
return Optional.empty();
}
}

Expand All @@ -37,7 +37,7 @@ public String resourceBodyOf(String resourcePath) {
}
throw new IllegalArgumentException("파일이 존재하지 않습니다.");
} catch (IOException e) {
throw new RuntimeException(e);
return null;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

public interface Controller {

Response handle(Request request);
Response<Object> handle(Request request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
public class Cookies {

private static final String SESSION_COOKIE = "JSESSIONID";
private Map<String, String> cookies;
private final Map<String, String> cookieValues;

public Cookies(Map<String, String> cookies) {
this.cookies = cookies;
public Cookies(Map<String, String> cookieValues) {
this.cookieValues = cookieValues;
}

public Optional<String> getCookieOf(String cookieName) {
if (!cookies.containsKey(cookieName)) {
if (!cookieValues.containsKey(cookieName)) {
return Optional.empty();
}
return Optional.of(cookies.get(cookieName));
return Optional.of(cookieValues.get(cookieName));
}

public Optional<String> getSessionCookie() {
if (!cookies.containsKey(SESSION_COOKIE)) {
if (!cookieValues.containsKey(SESSION_COOKIE)) {
return Optional.empty();
}
return Optional.of(cookies.get(SESSION_COOKIE));
return Optional.of(cookieValues.get(SESSION_COOKIE));
}
}

0 comments on commit 354b0ff

Please sign in to comment.