Skip to content

Commit

Permalink
dcache-vehicles: fix NPE in resolve symlink message
Browse files Browse the repository at this point in the history
Motivation:

see GH ` looking at Open Issue access the dCache namespace via Frontend in 9.1.1` #7250

See also https://rb.dcache.org/r/14013/

Not handling paths that don't begin with slash.

Modification:

Treat `null` as `/` and prepend '/' to relative paths.

Result:

Correct behavior without NPE or index out of bounds errors.

Target: master
Request: 9.1
Request: 9.0
(not backported to 8.2)
Bug: #7250
Closes: #7250
Requires-notes: yes
Acked-by: Dmitry
  • Loading branch information
alrossi committed Jul 24, 2023
1 parent 421e1dc commit b406b78
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -4,6 +4,7 @@

package org.dcache.vehicles;

import com.google.common.base.Strings;
import diskCacheV111.vehicles.PnfsMessage;

public class PnfsResolveSymlinksMessage extends PnfsMessage {
Expand All @@ -21,6 +22,11 @@ public PnfsResolveSymlinksMessage(String path) {
}

public PnfsResolveSymlinksMessage(String path, String prefix) {
if (Strings.emptyToNull(path) == null) {
path = "/";
} else if (path.charAt(0) != '/') {
path = "/" + path;
}
setPnfsPath(path);
this.prefix = prefix;
setReplyRequired(true);
Expand Down

0 comments on commit b406b78

Please sign in to comment.