[MAGNOLIA-5704] NewPropertyTask fails with NPE if nodePath does not exist Created: 28/Feb/14  Updated: 04/Jun/14  Resolved: 03/Jun/14

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 5.2.2
Fix Version/s: 5.2.6, 5.3

Type: Bug Priority: Major
Reporter: Federico Grilli Assignee: Ondrej Chytil
Resolution: Fixed Votes: 0
Labels: trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
supersession
is superseded by MAGNOLIA-5683 Delta tasks should fail gracefully Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

This is due to the usage of SessionUtil.getNode(..) instead of using directly the jcr session. The latter would throw a PathNotFoundException which would be caught and reported to the user, the former returns null which is subsequently passed the newProperty(..) method which then fails badly with NPE.



 Comments   
Comment by Roman Kovařík [ 30/May/14 ]
  1. Please don't extend RepositoryTestCase if it isn't really necessary (to save build time).
  2. A] assertTrue(session.getNode("/test").hasProperty("testProp"));
    B] Please use assertThat(session.propertyExists("/test/testProp"), is(true)); instead.
    Compare test reports:
    A] java.lang.AssetionError
    B] java.lang.AssetionError: Expected: is <false> but: was <true>)
Generated at Mon Feb 12 04:07:36 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.