UserPrincipalLookupService service = target.getFileSystem().getUserPrincipalLookupService();
return new BlockingAction<Void>(handler) {
public Void perform() {
try {
final UserPrincipal userPrincipal = user == null ? null : service.lookupPrincipalByName(user);
final GroupPrincipal groupPrincipal = group == null ? null : service.lookupPrincipalByGroupName(group);
if (groupPrincipal != null) {
PosixFileAttributeView view = Files.getFileAttributeView(target, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
if (view == null) {
throw new FileSystemException("Change group of file not supported");