Skip to content

Commit

Permalink
srmclient: update ls to be more robust
Browse files Browse the repository at this point in the history
Motivation:

The SRM server may refrain from returning an ArrayOfSubPaths if the
directory is empty.  Currently this causes an NPE.

Modification:

Check whether ArrayOfSubPaths is not specified before trying to use that
information.

Result:

Client can handle empty directories.

Target: master
Request: 2.16
Requires-notes: no
Requires-book: no
Patch: https://rb.dcache.org/r/9774/
Acked-by: Albert Rossi
  • Loading branch information
paulmillar committed Sep 26, 2016
1 parent f0f56bc commit aa609fd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ public TMetaDataPathDetail[] list(URI surl, boolean verbose) throws RemoteExcept
throw new SRMInvalidPathException("Not a directory");
}
offset += count;
TMetaDataPathDetail[] pathDetailArray = detail.getArrayOfSubPaths().getPathDetailArray();
TMetaDataPathDetail[] pathDetailArray = detail.getArrayOfSubPaths() == null
? null : detail.getArrayOfSubPaths().getPathDetailArray();
if (pathDetailArray != null) {
list = concat(list, pathDetailArray, TMetaDataPathDetail.class);
}
Expand Down

0 comments on commit aa609fd

Please sign in to comment.