Skip to content

Commit cc34444

Browse files
committed
#787 CookieHandlers now check for empty context path string instead of null
1 parent 60b9371 commit cc34444

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

core/http/workbench/src/main/java/org/eclipse/rdf4j/workbench/proxy/CookieHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected String getCookie(final HttpServletRequest req, final HttpServletRespon
6060

6161
private void initCookie(final Cookie cookie, final HttpServletRequest req) {
6262
final String context = req.getContextPath();
63-
cookie.setPath(null == context ? "/" : context);
63+
cookie.setPath(context.isEmpty() ? "/" : context);
6464
if (maxAge != null) {
6565
cookie.setMaxAge(Integer.parseInt(maxAge));
6666
}

core/http/workbench/src/main/java/org/eclipse/rdf4j/workbench/util/CookieHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private void addCookie(final WorkbenchRequest req, final HttpServletResponse res
5858
LOGGER.info("name: {}\nvalue: {}", name, value);
5959
LOGGER.info("un-encoded value: {}\n--", raw);
6060
final Cookie cookie = new Cookie(name, value);
61-
if (null == req.getContextPath()) {
61+
if (req.getContextPath().isEmpty()) {
6262
cookie.setPath("/");
6363
}
6464
else {
@@ -96,7 +96,7 @@ public void addTotalResultCountCookie(WorkbenchRequest req, HttpServletResponse
9696

9797
public void addCookie(WorkbenchRequest req, HttpServletResponse resp, String name, String value) {
9898
final Cookie cookie = new Cookie(name, value);
99-
if (null == req.getContextPath()) {
99+
if (req.getContextPath().isEmpty()) {
100100
cookie.setPath("/");
101101
}
102102
else {

0 commit comments

Comments
 (0)