Details
-
Bug
-
Resolution: Won't Fix
-
Neutral
-
None
-
5.5.6
-
None
-
None
Description
There is a problem in line String fullFragment = ("/".equals(getRootPath()) ? "" : getRootPath()) + urlFragment;
If the rootPath is configured, the fragment will be appended more rootPath, although the fragment is full path here.
eg: rootPath: /data/products
In linkedField: /data/products/cars/car1
Value when debugging: fullFragment: /data/products/data/products/cars/car1
So It causes a problem in choose dialog: item is not re-selected when open choose dialog in linkField
@Override
public JcrItemId getItemIdByUrlFragment(String urlFragment) {
try {
String fullFragment = ("/".equals(getRootPath()) ? "" : getRootPath()) + urlFragment;
String nodePath = JcrItemUtil.parseNodeIdentifier(fullFragment);
nodePath = !StringUtils.isBlank(nodePath) ? nodePath : getRootPath();
JcrItemId nodeItemId = JcrItemUtil.getItemId(getWorkspace(), nodePath);
if (nodeItemId == null || !JcrItemUtil.isPropertyItemId(fullFragment)) {
return nodeItemId;
} else {
return new JcrPropertyItemId(nodeItemId, parsePropertyName(fullFragment));
}
} catch (RepositoryException e) {
log.error("Failed to obtain JCR id for fragment: " + e.getMessage(), e);
return null;
}
}
Checklists
Acceptance criteria