Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ alpha-4
### Bugs Fixes

- [args] 28 instances of bad InputArgument constructor fixed
- [node] `node:list` Catch exceptions when rendering property rows (e.g. on invalid references)

alpha-3
-------
Expand Down
8 changes: 8 additions & 0 deletions features/phpcr_node_list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ Feature: List properites and chidren of current nodeA
"""
jcr:uuid
"""

Scenario: Catch exception on invalid reference
Given I execute the "node:list /tests_general_base/numberPropertyNode/jcr:content" command
Then the command should not fail
And I should see the following:
"""
One or more weak reference targets have not been found
"""
15 changes: 11 additions & 4 deletions src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,22 @@ private function renderProperties($currentNode, $table, $spacers)

$i = 0;
foreach ($properties as $name => $property) {
$i++;
if (isset($propertyNames[$name])) {
unset($propertyNames[$name]);
try {
$i++;
if (isset($propertyNames[$name])) {
unset($propertyNames[$name]);
}

$valueCell = $this->textHelper->truncate($this->formatter->formatValue($property), 55);

} catch (\Exception $e) {
$valueCell = '<error>' . $e->getMessage() . '</error>';
}

$table->addRow(array(
'<property>' . implode('', $spacers). $name . '</property>',
'<property-type>' . $this->formatter->getPropertyTypeName($property->getType()) . '</property-type>',
$this->textHelper->truncate($this->formatter->formatValue($property), 55),
$valueCell
));
}

Expand Down