[MAGNOLIA-6172] BootstrapFileUtil wraps IOException and JDOMException into RuntimeException without meaningful error message Created: 17/Apr/15  Updated: 02/Jun/15  Resolved: 17/Apr/15

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.9

Type: Bug Priority: Neutral
Reporter: Milan Divilek Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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   

info.magnolia.module.delta.BootstrapFileUtil wraps IOException and JDOMException into RuntimeException without meaningful error message. This is problem for example with info.magnolia.module.delta.PartialBootstrapTask because we should not catch RuntimeException there and then we don't know which resources was cause of fail.

2015-04-17 10:27:28,280 ERROR info.magnolia.module.InstallContextImpl           : > Could not perform installation: java.net.MalformedURLException
java.lang.RuntimeException: java.net.MalformedURLException
	at info.magnolia.module.delta.BootstrapFileUtil.getDocument(BootstrapFileUtil.java:68)
	at info.magnolia.module.delta.BootstrapFileUtil.getElementsFromXPath(BootstrapFileUtil.java:74)
	at info.magnolia.module.delta.BootstrapFileUtil.getElementFromXPath(BootstrapFileUtil.java:93)

info.magnolia.module.delta.BootstrapFileUtil also fails on NPE when hierarchy in bootstrap file doesn't contain the node path.

java.lang.NullPointerException
at info.magnolia.module.delta.BootstrapFileUtil.getElementAsStream(BootstrapFileUtil.java:102)


 Comments   
Comment by Aleksandr Pchelintcev [ 03/May/15 ]

mdivilek Just a friendly FYI: as of 5.4 there should be more convenient/expressive approaches to test exceptions like these:
info.magnolia.test.hamcrest.UtilMatchers#isExceptionWithMatchingMessage(java.lang.Class<? extends java.lang.Throwable>, org.hamcrest.Matcher<java.lang.String>)

Generated at Mon Feb 12 04:11:59 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.