[MAGNOLIA-2361] Content2bean: get a more explicit message when class property exists but is empty Created: 11/Sep/08  Updated: 23/Jan/13  Resolved: 12/Sep/08

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 3.6.2, 3.6.3

Type: Bug Priority: Major
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: content2bean
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   

original title: fallback to default implementation when class property is empty or wrongly set ?

To be discussed: as per MAGNOLIA-1688, it might be useful to fallback to the default implementation class when a class property is set to an unexisting class or is empty. I am not entirely convinced, because this is typically a configuration mistake and it should not be ignored. Maybe a precise warning/error log before falling back would be good. (depending on what component is being configured, this could otherwise block the system - i.e for filters for instance)



 Comments   
Comment by Philipp Bracher [ 12/Sep/08 ]

I am against it because it is very risky. In cases this behavior is explicitly wished it might be done in a custom transformer (by catching the class not found exception).

Comment by Philipp Bracher [ 12/Sep/08 ]

So resolve the issue (reopen it in case you don't agree)

Comment by Philipp Bracher [ 12/Sep/08 ]

If no class is defined c2b uses the magnolia properties to resolve the default implementation class.

Comment by Magnolia International [ 12/Sep/08 ]

My main concern was actually for when the class property exists but does not have any value; I just realized that in fact the error log was still pretty clear in this case:

WARN  info.magnolia.content2bean[...] can't resolve class for node /modules/adminInterface/virtualURIMapping/default
java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
[...]

However I've just added a little check that will behave exactly the same way if the class property is empty, but with a more explicit message in the ClassNotFoundException than an empty string.

Comment by Magnolia International [ 12/Sep/08 ]

fixed in trunk

Generated at Mon Feb 12 03:35:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.